MODEL_DIAGNOSTICS: The Hessian of the dynamic model contains Inf or NaN

Dear all, since I couldn’t replicate the MXN model, I tried to simplify it by reducing it to 3 sectors. Tradable goods sector, non-tradable goods sector and final good producing firm which combines tradable and nontradable with a CES aggregation function. The model produced sensible IRFs but when I run model diagnostics I encountered this error:

The Jacobian of the dynamic model contains Inf or NaN. The problem arises from:

The derivative of Equation 21 with respect to Variable d (initial value of d: -10.62)

MODEL_DIAGNOSTICS: The problem most often occurs, because a variable with
MODEL_DIAGNOSTICS: exponent smaller than 1 has been initialized to 0. Taking the derivative
MODEL_DIAGNOSTICS: and evaluating it at the steady state then results in a division by 0.
MODEL_DIAGNOSTICS: If you are using model-local variables (# operator), check their values as well.

I checked the equation 21 it is the standard debt elastic interest rate equation. There are two parameters zeta which measures sensitivity of debt and r* world interest rate. I couldn’t find an error what might be the problem?

Is it correct that d is negative in steady state?

Yes, I thought the country is lending if d is positive and borrowing if it is negative. Am I wrong? Attached you can find the related mod file.

Many many thanks

mn.mod (16.2 KB)

That file runs on my machine without producing an error

it produce error with model_diagnostics

In Dynare 4.5.7 it does not produce any errors.

Prof. Pfeifer I was using 4.5.6. I downloaded 4.5.7 and still I receive the error message. I am using Mac could that be the reason?

If you allow, I have few more questions for you.
1- In my model interest rate shocks have very little (less than 1%-5% in variance decomposition) response to macroeconomic variables. And government spending shock which is expected to have little impact have high variance decomposition up to 50%. What might be the reason?
2- some variables like government spending have very strange saw blade like impulse responses.
3- In the steady state consumption is 90% of output, investment is too low. It does not match with the stylized facts. How can I match the model to the data?