I was able to upgrade a Magento store from 2.1.6 to 2.2.0. The backend is working very good, but I am encountering an exception on the front office.

The exception message says: Element 'block', attribute 'type': The attribute 'type' is not allowed.

The whole situation is described in the next post from GitHub: https://github.com/magento/magento2/issues/11839

I'm new in Magento. Could give me a link which describes from where should I remove the invalid type attribute or other attributes or from where can I refactor it?

  • It looks you're messing the setup array. Share the full exception, preferably with the code part here. Oct 29, 2017 at 22:29
  • This is a part of code: 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'type': The attribute 'type' is not allowed. Line: 684 Element 'block', attribute 'type': The attribute 'type' is not allowed. Line: 692 Same code repeats on multiple lines (699, 732, 737, 748, 753). After that I get multiple lines with: Magento\Framework\Config\Dom->_initDom /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Config\Dom->__construct
    – user60246
    Oct 30, 2017 at 9:38

2 Answers 2


Those lines are most likely ones in your layout XMLs:

Element 'block', attribute 'type': The attribute 'type' is not allowed.
Line: 776

Element 'block', attribute 'type': The attribute 'type' is not allowed.
Line: 783

Element 'block', attribute 'type': The attribute 'type' is not allowed.
Line: 816

Most likely in layout XMLs you have declarations like

<block type="..."

Which does not correspond to lib/internal/Magento/Framework/View/Layout/etc/elements.xsd and need to be replaced to

<block class="..."
  • You were right. There was about layout XMLs. But, as expected, I have encountered the following error on a custom module: Fatal error: Uncaught Error: Cannot instantiate interface TemplateMonster\FilmSlider\Api\SliderRepositoryInterface I think I should add a new preference code block in di.xml.
    – user60246
    Oct 30, 2017 at 10:15
  • Normally preferences should be added by modules which introduced new interfaces. Please mark my answer as appropriate if initial issue is solved by suggested approach so that it can help others. If problem with SliderRepositoryInterface will be hard to solve, post it as another question.
    – Orlangur
    Oct 30, 2017 at 10:57
  • I have solved that problem also. Thank you for all your support!
    – user60246
    Oct 31, 2017 at 19:56
  • @Iulian, what was the fix you did? Running into the same error with the Templatemonster/FilmSlider..
    – Rann
    Nov 8, 2017 at 13:13

You are in 'MAGE_MODE' => 'developer' mode. You need to switch to 'MAGE_MODE' => 'default. Switch to the developer mode Magento 2 enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.