In production mode, my website is working fine. But as soon as I enable developer mode, I can not use command line any more.

In developer mode, if I use for example php bin/magento cache:flush, I'll get the following error.

Invalid Document
Element 'virtualType', attribute 'name': [facet 'pattern'] The value '01' is not accepted by the pattern '(\\?[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)(\\[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)*'.
Line: 23

Element 'virtualType', attribute 'name': '01' is not a valid value of the atomic type 'phpClassName'.
Line: 23

Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either invalid or something strange happend.
Line: 23

This happens to every command I use in developer mode. What happened?


with an IDE, find the string <virtualType name=" in your app/code folder or also by command-line grep -R '<virtualType name="' app/code

and then one of these declarations will likely have an empty name or invalid character.

If app/code does not give anything, you may have to do the same in vendor folder but less likely

if this is not easy because there are a lot of di.xml. You may disable one by one the installed third-party modules and flush the cache, try again..

  • I'll try this later and let you know the result. So you think it's some 3rd part modules that gives the problem? – Magento Learner Jul 25 '18 at 7:09
  • either third-party. Often, for myself it is on my own code forgetting to write my di.xml correctly or my IDE cutting the name of the virtualType by bad copy/paste – Herve Tribouilloy Jul 25 '18 at 7:14
  • Thanks for the help. It was the case. I had a extension that had <virtualType name="'01'">, I changed that and everything's working again. – Magento Learner Jul 30 '18 at 18:45

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.