Issue with Ramsey Optimal policy

Hi everyone, I am trying to to run the attached file in order to obtain the Ramsey optimal policy in the framework of a subsidy. However, Dynare returns this error:

ERROR: You cannot include exogenous variables in the planner objective. Please define an auxiliary endogenous variable like eps_aux=epsilon and use it instead of the varexo.

The model is loglinear.

Thank you very much for the help!
Sussidio_MC_NKPC.mod (6.3 KB)

The specific message is a bug. The problem is your using an undefined object chi in the planner_objective. I guess it must be defined as a parameter.
Also note that in

chi=1/(n_bar^phi)*(S^sigma);

the S was not defined.

Thank you very much, I will try to fix this.

Is there any problem concerning the fact that my model is loglinear? Can I use this approach nevertheless?

Thank you again

Generally, welfare is a higher order property. A loglinear (first order) model is only appropriate under certain conditions like an undistorted steady state.

Thank you very much professor! In the end I fixed the problem by considering the model in level