I'm receiving this error message which is mentioned below, but as you can see in the image there are no XML updates, neither content, how can I fix it?

Please correct the XML data and try again. Element 'reference': This element is not expected. Expected is one of ( referenceContainer, container, update, move, head, body ). Line: 1

Magento2 This element is not expected

1 Answer 1


Probably there is an old XML in the database, check the cms_page table in the custom_layout_update_xml. When you find and remove the XML changes directly from the database it will be solved and you might be able to save your CMS Page normally.

Magento2 This element is not expected fixed

It's happening because you updated your Magento and it was saved there before, this updated version didn't recognize the XML to render in the page to be removed or edited.

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.