Loos function for sentral bank

Hello friends;
Excuse me, I want to write a loss function for the central bank. But when I code like this, does it give these errors:

//monetary policy
planner_objective (lambday*y^2+lambdapic*pic^2);
ramsey_policy(planner_discount=betta, instruments=(rmb), irf=20, periods=10092); 

WARNING: GGTC.mod:339.1-80: The ‘ramsey_policy’ statement is deprecated. Please use ‘ramsey_model’, ‘stoch_simul’, and ‘evaluate_planner_objective’ instead.
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.

I targeted the two variables of production and inflation, both of which are endogenous, but I do not know the reason for this error.

To codify the loss function, I added this command to my model and removed the monetary base growth rate relationship that was the central bank policy relationship.
Did I have to do anything other than these two cases so that he would not make this error ??

Thank you for your help.

I would need to see the full file.