diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc
index aa8b3796bf92532691a8bc573a6a7655b4888186..09d81ccf96d8ed8b4ba2257d9fdbb2d1424a874d 100644
--- a/preprocessor/ParsingDriver.cc
+++ b/preprocessor/ParsingDriver.cc
@@ -323,6 +323,9 @@ ParsingDriver::add_model_variable(int symb_id, int lag)
   if (dynamic_cast<StaticModel *>(model_tree) != NULL && lag != 0)
     error("Leads and lags on variables are forbidden in 'planner_objective'.");
 
+  if (dynamic_cast<StaticModel *>(model_tree) != NULL && type == eModelLocalVariable)
+    error("Model local variable " + mod_file->symbol_table.getName(symb_id) + " cannot be used in 'planner_objective'.");
+
   // It makes sense to allow a lead/lag on parameters: during steady state calibration, endogenous and parameters can be swapped
   return model_tree->AddVariable(symb_id, lag);
 }