skip to Main Content

I’m getting this error in magento 2. I didn’t do any updates, this error just suddenly appeared.

I see that I have to remove the “after” attribute, but where can I find where?

1 exception(s):
Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'referenceContainer', attribute 'after': The attribute 'after' is not allowed.
Line: 1251


Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'referenceContainer', attribute 'after': The attribute 'after' is not allowed.
Line: 1251

#0 /www/htdocs/domain/vendor/magento/framework/Config/Dom.php(115): MagentoFrameworkConfigDom->_initDom('<layout xmlns:x...')
#1 /www/htdocs/domain/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): MagentoFrameworkConfigDom->__construct('<layout xmlns:x...', Object(MagentoFrameworkAppArgumentsValidationState), Array, NULL, '/www/htdocs/w00...', '%message%nLine:...')
#2 /www/htdocs/domain/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject('Magento\Framewo...', Array)
#3 /www/htdocs/domain/vendor/magento/framework/ObjectManager/ObjectManager.php(56): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create('Magento\Framewo...', Array)
#4 /www/htdocs/domain/vendor/magento/framework/Config/DomFactory.php(42): MagentoFrameworkObjectManagerObjectManager->create('Magento\Framewo...', Array)
#5 /www/htdocs/domain/vendor/magento/framework/View/Model/Layout/Update/Validator.php(125): MagentoFrameworkConfigDomFactory->createDom(Array)
#6 /www/htdocs/domain/vendor/magento/framework/View/Model/Layout/Merge.php(461): MagentoFrameworkViewModelLayoutUpdateValidator->isValid('<layout xmlns:x...', 'layout_merged', false)
#7 /www/htdocs/domain/vendor/magento/framework/View/Model/Layout/Merge.php(442): MagentoFrameworkViewModelLayoutMerge->_validateMergedLayout('LAYOUT_frontend...', '<body>n   <refe...')
#8 /www/htdocs/domain/generated/code/Magento/Framework/View/Model/Layout/Merge/Interceptor.php(193): MagentoFrameworkViewModelLayoutMerge->load(Array)
#9 /www/htdocs/domain/vendor/magento/framework/View/Layout/Builder.php(86): MagentoFrameworkViewModelLayoutMergeInterceptor->load()
#10 /www/htdocs/domain/vendor/magento/framework/View/Layout/Builder.php(63): MagentoFrameworkViewLayoutBuilder->loadLayoutUpdates()
#11 /www/htdocs/domain/vendor/magento/framework/View/Layout.php(254): MagentoFrameworkViewLayoutBuilder->build()
#12 /www/htdocs/domain/vendor/magento/framework/View/Layout.php(875): MagentoFrameworkViewLayout->build()
#13 /www/htdocs/domain/generated/code/Magento/Framework/View/Layout/Interceptor.php(414): MagentoFrameworkViewLayout->getBlock('page_content_he...')
#14 /www/htdocs/domain/vendor/magento/module-cms/Helper/Page.php(171): MagentoFrameworkViewLayoutInterceptor->getBlock('page_content_he...')
#15 /www/htdocs/domain/vendor/magento/module-cms/Controller/Noroute/Index.php(44): MagentoCmsHelperPage->prepareResultPage(Object(MagentoCmsControllerNorouteIndexInterceptor), 'no-route')
#16 /www/htdocs/domain/generated/code/Magento/Cms/Controller/Noroute/Index/Interceptor.php(24): MagentoCmsControllerNorouteIndex->execute()
#17 /www/htdocs/domain/vendor/magento/framework/App/Action/Action.php(107): MagentoCmsControllerNorouteIndexInterceptor->execute()
#18 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#19 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCmsControllerNorouteIndexInterceptor->___callParent('dispatch', Array)
#20 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCmsControllerNorouteIndexInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#21 /www/htdocs/domain/generated/code/Magento/Cms/Controller/Noroute/Index/Interceptor.php(39): MagentoCmsControllerNorouteIndexInterceptor->___callPlugins('dispatch', Array, Array)
#22 /www/htdocs/domain/vendor/magento/framework/App/FrontController.php(55): MagentoCmsControllerNorouteIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#23 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
#24 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkAppFrontControllerInterceptor->___callParent('dispatch', Array)
#25 /www/htdocs/domain/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#26 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(135): MagentoStoreAppFrontControllerPluginRequestPreprocessor->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#27 /www/htdocs/domain/vendor/mirasvit/module-search-autocomplete/src/SearchAutocomplete/Plugin/ResponsePlugin.php(157): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#28 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(135): MirasvitSearchAutocompletePluginResponsePlugin->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#29 /www/htdocs/domain/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#30 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(135): MagentoPageCacheModelAppFrontControllerBuiltinPlugin->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#31 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#32 /www/htdocs/domain/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins('dispatch', Array, Array)
#33 /www/htdocs/domain/vendor/magento/framework/App/Http.php(135): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#34 /www/htdocs/domain/vendor/magento/framework/App/Bootstrap.php(256): MagentoFrameworkAppHttp->launch()
#35 /www/htdocs/domain/index.php(39): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttp))
#36 {main}

I see that I have to remove the “after” attribute, but where can I find where?

thanks

4

Answers


  1. You can not add after attribute in referenceContainer. If you want to move Container then use it.

        <move element="element name" destination="where you want to move" after="">
    
    Login or Signup to reply.
  2. You will have to add a new ticket to extension support because this is extension problem. You can check all the xml file in path app/code/vendor_name/module_name/view/frontend/layout/

    Login or Signup to reply.
  3. I think, You are using magento2.2 version. In this version, There is some modification in layout xml. You can not use after and before attribute in referenceContainer tag.

    To solve this issue, You have to remove after and before attribute from referenceContainer.

    you can use move tag for rearranging layout

    Login or Signup to reply.
  4. As zed stated, this looks more like an upgrade issue to v2.2.x as they made the layout formatting stricter and some things which were allowed before are no longer.

    The before and after attributes in referenceContainer tags are no longer valid.

    Also we found that a move tag was also no longer allowed inside a referenceBlock tag either.

    To find where these issues were at, I went into the vendor/magento/framework/Config/Dom.php file and in the _initDom() method output the $xml variable to find the actual xml code at line xxx per an exception like the one OP has above.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search