I have developed a simple two sector dsge model, with sectoral output and inflation determined in two sectors and aggregated at the country level. There are two sectoral shocks for each sector and two aggregate output and inflation shocks.
However, I get the following error message:

There are 3 eigenvalue(s) larger than 1 in modulus
for 4 forward-looking variable(s)
The rank condition ISN’T verified!
error: Blanchard Kahn conditions are not satisfied: indeterminacy

Now I have solved the problem for the simple model, but I want a two sector dsge for a more complex model. The timing is 100% correct, but I think the links between the two sectors and the foreign economy are insufficiently specified. That is why I get a message that the BK conditions are not satisfied: (There are 16 eigenvalue(s) larger than 1 in modulus
for 16 forward-looking variable(s) The rank condition ISN’T verified!)

How can I close this model appropriately? Here are the model equations:

That is very hard to debug. Please start from the working simple version and then add the features back. That is the only way to see where things go wrong.

The closed economy version works fine, this is the most simple version that works. In the model above the domestic output is simply the weighted sum of the sectoral output, but when I also add the imports as demand component, I get a slightly different error message:

Blanchard Kahn conditions are not satisfied: indeterminacy due to rank failure

In principle, when I have indeterminacy due to rank failure, this means that there are eigenvalues that are zero and that the matrix does not have full rank, right? What does that mean in practical terms? Does it mean that an additional variable that is introduced must also influence those variables, where I have eigenvalues of zero?

Usually it means that one variable in your model cannot be determined, because in the linearized system, the matrix relating contemporaneous variables is not of full rank. This often happens because of Walras’s Law as one market clearing condition is redundant. If n-1 markets clear, the last one also clears. This in turn implies that a different equation is missing that would pin the one undetermined variable down. This is extremely hard to debug without knowing the model in detail. That’s why I told you to start with a working version and go from there. That limits the size of the code where the problem could have been introduced.

I have now found a solution for this. The redundant equation was a second Euler equation and the missing equation was the labor market clearing condition.
However, I get oscillatory irfs and the shock decomposition depends entirely on initial values. Do you know how to fix this?

Do you have a unit root in your model and is it desired? The IRFs seem not come back to the steady state. And what is the variable you are displaying? The scaling look huge.

The unit root is desired. I think it comes from the definition of the real exchange rate qq-qq(-1)=pif-pi+eqq-eqq(-1); However, in the one sector model this does not lead to such oscillatory irfs as in the two sector model.
The variable that was displayed is total outptut y, i.e. the sum of the sectoral outputs.

The nominal variables have a unit root. That is normal, but it seems output in your model has one as well, which is not normal. What happens if you set irf=1000? Does the IRF return?