I attempt to add a government to the RBC model. The government levies distortionary taxes and issues non-state-contingent bonds. Dynare tells me that There are 3 eigenvalue(s) larger than 1 in modulus for 2 forward-looking variable(s). The rank condition ISN’T verified! I think that the problem lies in the bond interest rate, but I want someone to help me explain the reason. Thank you!

// Endogenous variables:

var C K Y B R W r z g;

// Exogenous variable:

varexo epis_z,epis_g;

// Parameters declaration and calibration

parameters alfa betta delta rho_z rho_g sigmma_z sigmma_g gbar tau_a tau_n;

alfa=0.34;

betta=0.98;

delta=0.025;

rho_z=0.95;

rho_g=0.87;

sigmma_z=0.007;

sigmma_g=0.04;

gbar=0.28;

tau_a=0.2;

tau_n=0.3;

// Equilibrium conditions

model;

log(z)=rho_z * log(z(-1))+epis_z;

log(g/gbar)=rho_g * log(g(-1)/gbar)+epis_g;

tau_n*W+tau_a*r*K(-1)+B=B(-1) R(-1)+g;*K(-1)^alfa;

1/C=betta((1-tau_a)r(+1)+1-delta)/C(+1);

1/C=bettaR/C(+1);

W=(1-alfa)Y;

r=alfaY/K(-1);

Y = z

C+K+g=Y+(1-delta)*K(-1);

end;

initval;

z = 1;

g = gbar;

R=1/(betta);

r = 1/((1-tau_a)*betta)+delta-1;
K=(r/alfa)^(1/(1-alfa));
Y = z*K^alfa;

C = Y-g-delta*K;

end;

steady;

// Check the Blanchard-Kahn conditions

check;

// Declare a positive technological shock in period 1

shocks;

var epis_z;

stderr sigmma_z;

var epis_g;

stderr sigmma_g;

end;

stoch_simul;