Magento 2.x – Constant name is expected. Error message.

When trying to run any bin/magento command, or just trying to access the site, and getting this error message.

The first thing you should try to get that solved, is identifying where the issue is.

To do so, i suggest digging into that file, and adding the corresponding log message, as follows:

file: vendor/magento/framework/Data/Argument/Interpreter/Constant.php

and add print_r($data);exit;   before the throw, like this:

After that, you will see something like this:

So now, with that information, you will be able to understand which is the constant that needs to be fixed.


Hope this helps.