Hi,
I am new to magento, but I managed to work a little bit with it. I build a theme for magento 2.1 and was working fine. Then I had to upgrade to magento 2.2.1 did that and everything work fine.
But one day out of know where I started to get this error, when I visit the front end. And cannot figure out what is causing the problem. Is there a way to troubleshoot the problem, or does anyone know how to fix this?
thanks in advance. below you will fine the error page that is showing:
1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'link', attribute 'href': The attribute 'href' is not allowed. Line: 747 Element 'link': The attribute 'src' is required but missing. Line: 747 Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'link', attribute 'href': The attribute 'href' is not allowed. Line: 747 Element 'link': The attribute 'src' is required but missing. Line: 747 #0 E:\xampp\htdocs\temp\vendor\magento\framework\Config\Dom.php(115): Magento\Framework\Config\Dom->_initDom('<layout xmlns:x...') #1 E:\xampp\htdocs\temp\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(111): Magento\Framework\Config\Dom->__construct('<layout xmlns:x...', Object(Magento\Framework\App\Arguments\ValidationState), Array, NULL, 'E:/xampp/htdocs...', '%message%\nLine:...') #2 E:\xampp\htdocs\temp\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array) #3 E:\xampp\htdocs\temp\vendor\magento\framework\ObjectManager\ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array) #4 E:\xampp\htdocs\temp\vendor\magento\framework\Config\DomFactory.php(42): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array) #5 E:\xampp\htdocs\temp\vendor\magento\framework\View\Model\Layout\Update\Validator.php(125): Magento\Framework\Config\DomFactory->createDom(Array) #6 E:\xampp\htdocs\temp\vendor\magento\framework\View\Model\Layout\Merge.php(461): Magento\Framework\View\Model\Layout\Update\Validator->isValid('<layout xmlns:x...', 'layout_merged', false) #7 E:\xampp\htdocs\temp\vendor\magento\framework\View\Model\Layout\Merge.php(442): Magento\Framework\View\Model\Layout\Merge->_validateMergedLayout('LAYOUT_frontend...', '<!--\r\n <refe...') #8 E:\xampp\htdocs\temp\generated\code\Magento\Framework\View\Model\Layout\Merge\Interceptor.php(193): Magento\Framework\View\Model\Layout\Merge->load(Array) #9 E:\xampp\htdocs\temp\vendor\magento\framework\View\Layout\Builder.php(86): Magento\Framework\View\Model\Layout\Merge\Interceptor->load() #10 E:\xampp\htdocs\temp\vendor\magento\framework\View\Layout\Builder.php(63): Magento\Framework\View\Layout\Builder->loadLayoutUpdates() #11 E:\xampp\htdocs\temp\vendor\magento\framework\View\Layout.php(254): Magento\Framework\View\Layout\Builder->build() #12 E:\xampp\htdocs\temp\vendor\magento\framework\View\Layout.php(875): Magento\Framework\View\Layout->build() #13 E:\xampp\htdocs\temp\generated\code\Magento\Framework\View\Layout\Interceptor.php(414): Magento\Framework\View\Layout->getBlock('page_content_he...') #14 E:\xampp\htdocs\temp\vendor\magento\module-cms\Helper\Page.php(171): Magento\Framework\View\Layout\Interceptor->getBlock('page_content_he...') #15 E:\xampp\htdocs\temp\vendor\magento\module-cms\Controller\Index\Index.php(43): Magento\Cms\Helper\Page->prepareResultPage(Object(Magento\Cms\Controller\Index\Index\Interceptor), 'home') #16 E:\xampp\htdocs\temp\generated\code\Magento\Cms\Controller\Index\Index\Interceptor.php(24): Magento\Cms\Controller\Index\Index->execute(NULL) #17 E:\xampp\htdocs\temp\vendor\magento\framework\App\Action\Action.php(107): Magento\Cms\Controller\Index\Index\Interceptor->execute() #18 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http)) #19 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Cms\Controller\Index\Index\Interceptor->___callParent('dispatch', Array) #20 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #21 E:\xampp\htdocs\temp\generated\code\Magento\Cms\Controller\Index\Index\Interceptor.php(39): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array) #22 E:\xampp\htdocs\temp\vendor\magento\framework\App\FrontController.php(55): Magento\Cms\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #23 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http)) #24 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array) #25 E:\xampp\htdocs\temp\vendor\magento\module-store\App\FrontController\Plugin\RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #26 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #27 E:\xampp\htdocs\temp\vendor\magento\module-page-cache\Model\App\FrontController\BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #28 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #29 E:\xampp\htdocs\temp\vendor\magento\framework\Interception\Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #30 E:\xampp\htdocs\temp\generated\code\Magento\Framework\App\FrontController\Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL) #31 E:\xampp\htdocs\temp\vendor\magento\framework\App\Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #32 E:\xampp\htdocs\temp\vendor\magento\framework\App\Bootstrap.php(256): Magento\Framework\App\Http->launch() #33 E:\xampp\htdocs\temp\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http)) #34 {main}
Solved! Go to Solution.
Hi @robertbits,
Maybe this:
Replace
<link href="link to css" rel="stylesheet" type="text/css"/>
with src
<link src="link to css" rel="stylesheet" type="text/css"/>
The source of the solution is: https://magento.stackexchange.com/questions/200659/after-update-to-2-2-1-href-is-not-allowed (from @Rakesh Jesadiya)
I have faced same type of error in past for upgrade version from 2.1.* to 2.2.*
Issue is just simple to rename link tag with href to src and save file.
You just check in your default.xml or default_head_blocks.xml in your theme folder or any module layout file.
Replace
<link href="link_to_css" rel="stylesheet" type="text/css"/>
with src
<link src="link_to_css" rel="stylesheet" type="text/css"/>
Hi @robertbits,
Maybe this:
Replace
<link href="link to css" rel="stylesheet" type="text/css"/>
with src
<link src="link to css" rel="stylesheet" type="text/css"/>
The source of the solution is: https://magento.stackexchange.com/questions/200659/after-update-to-2-2-1-href-is-not-allowed (from @Rakesh Jesadiya)
I have faced same type of error in past for upgrade version from 2.1.* to 2.2.*
Issue is just simple to rename link tag with href to src and save file.
You just check in your default.xml or default_head_blocks.xml in your theme folder or any module layout file.
Replace
<link href="link_to_css" rel="stylesheet" type="text/css"/>
with src
<link src="link_to_css" rel="stylesheet" type="text/css"/>
thanks for your reply. I had 1 href in the xml, which put it as src and the error was gone.
but then I started to view another error:
1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file
After my troubleshooting I found out that this is being caused by the extensions that I wrote in the app\code\. I know this because when I removed this code, the website loaded fine. but of course the code is need so I need to figure out what the problem is. and this time it is not the href.
Is there a way to maybe view exactly the error what is it about? sine I really find it difficult to troubleshoot the problem.
Could you please check your var/system.log or report folder and check whether any critical error will display. based on those error we can give a judgement for your error.