Constant name is expected. Error

In order to help you debug what's going on, I would suggest to temporary edit the file

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

From this...

public function evaluate(array $data) {
    if(!isset($data['value']) || !defined($data['value'])) {
        throw new \InvalidArgumentException('Constant name is expected.');
    }
    return constant($data['value']);
}

To this...

public function evaluate(array $data) {
    if(!isset($data['value']) || !defined($data['value'])) {
        print_r($data);exit;                                                    // <<<<<<<<<<<<
        throw new \InvalidArgumentException('Constant name is expected.');
    }
    return constant($data['value']);
}

Thereby you will be notified of which class / constant is causing you the error :

enter image description here

Hope it could help someone else ;-) See ya


I think some problem in your etc folder. check all xml files. Constant name should be in CAPITAL letters. any of your constant remain in small letters. check it and correct it. Hope this will solve your Problem.


In a case when your extension is in app/code folder you will get this error if your folder name is different than module name after Magento_ in module.xml

for an example: if your module name is Magento_MyGreatModule your folder name must be MyGreatModule.