After I upgraded to Magento 2.3, running the command setup:di:compile, I get this error:

Area configuration aggregation... 5/7 [====================>-------]  71% 58 
secs 276.0 MiB
In ClassReader.php line 35:

  Class Magento\Email\Model\Source\Variables does not exist

In ClassReader.php line 29:

   Class Magento\Email\Model\Source\Variables does not exist


I've checked the database setup_module to ensure no mismatch or missing scheme/data versions but all are ok.

  • Have you override this class in custom module ? – user55548 Dec 15 '18 at 6:00
  • Thanks but i have disabled all custom modules so it must have something to do with Magento? – Mehdi Rafiai Dec 15 '18 at 9:58

Search for the missing class in your magento2 code, you can do via linux cli:

find /path/to/magento2-root -type f -iname '*.php' -print0 | xargs -0 grep -nw -e 'Magento\\Email\\Model\\Source\\Variables'

and comment any line calling this class (that was removed from magento2.3)


You can also change this class in Magento 2.3 for Magento\Variable\Model\Source\Variables

  • Finally, this solved the problem and i am now able to run setup:di:compile. Thank you! – Mehdi Rafiai Dec 18 '18 at 15:19
  • How you have fixed? – Magecode Mar 27 '19 at 6:04
  • perfect answer!!! +1 :) made my day – SagarPPanchal Aug 6 '19 at 6:41

I just replaced the class Magento\Email\Model\Source\Variables with Magento\Variable\Model\Source\Variables.


Dirty Hack

Rename registration.php file of module which is causing problem for compilation.



Have you used any SMTP extension? If yes then please remove that and then try to run the command :

php bin/magento setup:di:compile

If your issue is resolved then install 2.3 compatible SMTP extension.

  • I've not used any extensions like this, for further testing i removed env.php and config.php so i can reinstall Magento 2.3, i deselected all modules apart from what Magento needs and i still get the same error. – Mehdi Rafiai Dec 18 '18 at 9:14

Clear your generated folder and run the compile command.

rm -rf generated/*

Then run the compile command

bin/magento setup:di:compile
  • Thank you, done that plenty of times alongside var/* cache/* etc. No difference. – Mehdi Rafiai Dec 18 '18 at 10:37
  • Can you check if this class really exists: Magento\Email\Model\Source\Variables by going to that path. – Sourabh Kumar Sharma Dec 18 '18 at 10:38
  • I assume the path is generated/code/Magento/Email/Model - if so, there's no Source directory in there. – Mehdi Rafiai Dec 18 '18 at 10:48
  • In magento2.2 the class is there, but it looks like this class was removed from magento2.3. – gemig_hol Dec 18 '18 at 11:07
  • 1
    Let us continue this discussion in chat. – gemig_hol Dec 18 '18 at 14:28

If you use any custom extensions, check the compatibility with Magento 2.3

All extensions that are not compatible must be removed, for example, Mageplaza smtp was not compatible and Mageworx CEO tool is was also not compatible.

After then run below command: php bin/magent setup:di:compile

  • Understood, but as per my comments above i have disabled all modules and only left on what Magento needs. Stripped it down and i still get the same error. – Mehdi Rafiai Dec 18 '18 at 10:12

Class Bss\HtmlSiteMap\Model\Filter

public function __construct(
    \Magento\Email\Model\Source\Variables $configVariables,


public function __construct(
    \Magento\Variable\Model\Source\Variables $configVariables,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.