I have this problem and I can't locate where the problem is :

1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed. Line: 1124

This problem occurs as a connected customer, when I try to access the invoice for a test order.

Here is what I tried to do to solve the problem by following a lot of topics on this forum:

  • setup:di:compile
  • Delete the content of /pub/static/frontend
  • Deploy static content

Nothing works.

Note that I searched my XML for a referenceBlock with a class attribute, but I didn't find anything. Maybe I'm not looking in the right place?

The directories scanned to find the error: - /app/code - /app/design

Can someone explain to me how to locate this error more precisely? Or help me solve it?

EDIT : I made : grep -r -i --include \* '<referenceContainer' mySiteDirectory/ And there is no referenceBlock with "class" attribute.

EDIT 2 : With Luma theme, I have same problem. So I suppose it's coming from a module.

So... What to do please ?

Magento version 2.3.1

Thank you in advance.

  • Did you check any thirdparty module installed via composer? location should be 'vendor'?
    – Sohel Rana
    Jul 6, 2019 at 9:54
  • Oh gosh... No. I check and I will let you know. Jul 6, 2019 at 10:31
  • no referenceContainer with "class" attribute in vendor :( Jul 6, 2019 at 13:24
  • I made : grep -r -i --include * '<referenceContainer' mysiteDirectory/ I found nothing... Jul 6, 2019 at 15:34
  • Try grep -H -r '<referenceContainer' vendor/
    – Sohel Rana
    Jul 6, 2019 at 15:47

2 Answers 2


The error would suggest invalid XML in your theme and / or extensions.

There is a plugin for PHPstorm editor


You can then generate XML URN map to validate against.


Or better yet you can scan your code. I was going to type an answer on how to use it but then I came across this


The part you are interested in is 'How to use PhpStorm code inspector to validate project xml-files'

Let me know if any detail gets lost in translation.

But basically after generating the URN you can scan your XML code.

Sceenshot of me scanning XML code

  • Thank you very much for all your information. I have a problem with phpstorm. When I launched inspection and it find 5953 errors... I assumed that it was necessary to regenerate the URN map. I tried to click on the "Regenerate urn map" button but nothing is happening. Jul 7, 2019 at 10:17
  • Ok I found why... I'm working on preprod server. I'm not in local... So Magento 2 Module for phpstorm cannot help me. Jul 7, 2019 at 10:31

This is probably an issue in one of your xml files as you can not use class on the referenceBlock. Please check your theme. You can help for fixed issue.

Refer for further information:


  • Hello @Kirti I know that. As explained in my initial post, I searched everywhere a XML file were a referenceBlock have an attribute 'class'. But nothing. This is why I posted here. Thanks, Jul 6, 2019 at 8:42

Your Answer

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

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