I am working on a Two Sector TANK model for my thesis and have come across an error that I can’t figure out how to fix when I run my code on dynare. I am looking at the impact of different environmental policies (no policy, carbon tax, intensity target and cap and trade) on different macroeconomic variables under the Two Sector TANK setting. When I run the code taking tau_z_ss =0 in the parameters, i.e., the no policy framework, the code works and I am getting results. However, when I change it to anything other than 0 it falls apart and gives the error:

Warning: Matrix is singular to working precision.

In evaluate_steady_state (line 261)

In steady_ (line 55)

In steady (line 80)

In practice.driver (line 665)

In dynare (line 293)

Residuals of the static equations:

Equation number 1 : NaN : pi

Equation number 2 : NaN : T

Equation number 3 : NaN : w

Equation number 4 : NaN : 4

Equation number 5 : NaN : 5

Equation number 6 : NaN : X

Equation number 7 : NaN : C

Equation number 8 : NaN : C_R

Equation number 9 : NaN : Y_A

Equation number 10 : NaN : Y_M

Equation number 11 : NaN : A_M_star

Equation number 12 : NaN : Y

Equation number 13 : NaN : 13

Equation number 14 : NaN : C_A

Equation number 15 : NaN : 15

Equation number 16 : NaN : A

Equation number 17 : NaN : mc_M

Equation number 18 : NaN : N

Equation number 19 : NaN : T_N

Equation number 20 : NaN : T_tilda

Equation number 21 : NaN : w_N

Equation number 22 : NaN : 22

Equation number 23 : NaN : X_N

Equation number 24 : NaN : mc_M_tilda

Equation number 25 : NaN : pi_M

Equation number 26 : NaN : int

Equation number 27 : NaN : C_N

Equation number 28 : NaN : Y_N

Equation number 29 : NaN : Y_tilda

Equation number 30 : NaN : real_int

Equation number 31 : NaN : C_rat

Equation number 32 : NaN : N_N

Equation number 33 : NaN : Y_A_N

Equation number 34 : NaN : C_A_N

Equation number 35 : NaN : Y_M_N

Equation number 36 : NaN : C_PA

Equation number 37 : NaN : C_PM

Equation number 38 : NaN : C_RA

Equation number 39 : NaN : C_RM

Equation number 40 : NaN : Y_PA

Equation number 41 : NaN : A_M

Equation number 42 : NaN : A_A

Equation number 43 : NaN : phi

Equation number 44 : 0 : a

Equation number 45 : NaN : v

Equation number 46 : NaN : Ev

Equation number 47 : NaN : 47

Equation number 48 : NaN : 48

Equation number 49 : 0 : M

Equation number 50 : NaN : Z

Equation number 51 : 0 : U

Equation number 52 : NaN : AC

Error using print_info (line 32)

The steady state has NaNs or Inf.

Error in steady (line 102)

print_info(info,options_.noprint, options_);

Error in practice.driver (line 665)

steady;

Error in dynare (line 293)

evalin(‘base’,[fname ‘.driver’]) ;

I would appreciate any kind of help about the same. Thank you in advance for taking your time out. I have attached the code for reference