I have a non-linear model with 23 eq and 23 variables. I have defined the model block in the mod file, and as far as I know, if I do not define “initval,” Dynare will consider them zero, and thus steady-state values will be zero. However, every time I run the code, I get the following error: “The steady state has NaNs or Inf.” Is there anything wrong with the code?

you are right that if you do not specifically give Dynare initial values it will set them to zero. The second part is, however, wrong. It does not imply that the steady states are thus also zero, most likely they are quite the opposite. It just uses zero as a starting value for the steady state solver, which could be far away ant so make it impossible for Dynare to find it.

One danger when not giving initial values is that using zero as starting values could lead to incorrect specification for example if you then have 1/0 or, like what you have in your Taylor rule, log(0). This of course does not work.

Try either to calculate the steady state analytically or at least give proper (“good”) initial guesses of them.

Thank you for your response. I have one more question: I have obtained only some steady-state values analytically. Is it possible to combine these values and initial guesses within initval block? Does it give the correct steady-state (of course, conditional on proper initial guesses)?

everything that is in logs cannot have a steady state of 0. With the default initial value of 0, you will get log(0)=Inf.
2. Yes, you can combine true steady state values and initial guesses in an initval-block.