Magento 2.3.4 – Unable to Load Theme by Specified Key

adminmagento2.3.4

Here below errors shows when accessing categories within backend. Only started happening since updating to 2.3.4 yesterday. Seen similar errors however normally actually have a key specified and that theme is then missing however my error seems to be trying to pull a theme without a key.

Stack Trace:

Exception #0 (LogicException): Unable to load theme by specified key: ''
<pre>#1 Magento\Framework\View\Design\Theme\FlyweightFactory\Proxy->create('') called at [vendor/magento/module-catalog/Model/Category/Attribute/LayoutUpdateManager.php:72]
#2 Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager->getLayoutProcessor() called at [vendor/magento/module-catalog/Model/Category/Attribute/LayoutUpdateManager.php:95]
#3 Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager->fetchAvailableFiles(&Magento\Catalog\Model\Category\Interceptor#000000001086af1c000000002644233d#) called at [generated/code/Magento/Catalog/Model/Category/Attribute/LayoutUpdateManager/Proxy.php:95]
#4 Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager\Proxy->fetchAvailableFiles(&Magento\Catalog\Model\Category\Interceptor#000000001086af1c000000002644233d#) called at [vendor/magento/module-catalog/Model/Category/Attribute/Source/LayoutUpdate.php:38]
#5 Magento\Catalog\Model\Category\Attribute\Source\LayoutUpdate->listAvailableOptions(&Magento\Catalog\Model\Category\Interceptor#000000001086af1c000000002644233d#) called at [vendor/magento/module-catalog/Model/Attribute/Source/AbstractLayoutUpdate.php:94]
#6 Magento\Catalog\Model\Attribute\Source\AbstractLayoutUpdate->getOptionsFor(&Magento\Catalog\Model\Category\Interceptor#000000001086af1c000000002644233d#) called at [vendor/magento/module-catalog/Model/Category/DataProvider.php:387]
#7 Magento\Catalog\Model\Category\DataProvider->getAttributesMeta(&Magento\Eav\Model\Entity\Type#000000001086af1d000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#8 Magento\Catalog\Model\Category\DataProvider\Interceptor->___callParent('getAttributesMet...', array(&Magento\Eav\Model\Entity\Type#000000001086af1d000000002644233d#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#9 Magento\Catalog\Model\Category\DataProvider\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Eav\Model\Entity\Type#000000001086af1d000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#10 Magento\Catalog\Model\Category\DataProvider\Interceptor->___callPlugins('getAttributesMet...', array(&Magento\Eav\Model\Entity\Type#000000001086af1d000000002644233d#), array(array('category_ui_form...'))) called at [generated/code/Magento/Catalog/Model/Category/DataProvider/Interceptor.php:65]
#11 Magento\Catalog\Model\Category\DataProvider\Interceptor->getAttributesMeta(&Magento\Eav\Model\Entity\Type#000000001086af1d000000002644233d#) called at [vendor/magento/module-catalog/Model/Category/DataProvider.php:292]
#12 Magento\Catalog\Model\Category\DataProvider->prepareMeta(array()) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#13 Magento\Catalog\Model\Category\DataProvider\Interceptor->___callParent('prepareMeta', array(array())) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#14 Magento\Catalog\Model\Category\DataProvider\Interceptor->Magento\Framework\Interception\{closure}(array()) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#15 Magento\Catalog\Model\Category\DataProvider\Interceptor->___callPlugins('prepareMeta', array(array()), array(array('google_optimizer...'))) called at [generated/code/Magento/Catalog/Model/Category/DataProvider/Interceptor.php:39]
#16 Magento\Catalog\Model\Category\DataProvider\Interceptor->prepareMeta(array()) called at [vendor/magento/module-catalog/Model/Category/DataProvider.php:224]
#17 Magento\Catalog\Model\Category\DataProvider->getMeta() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#18 Magento\Catalog\Model\Category\DataProvider\Interceptor->___callParent('getMeta', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#19 Magento\Catalog\Model\Category\DataProvider\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/Ui/Category/Form/DataProviderPlugin.php:96]
#20 Smile\ElasticsuiteCatalog\Plugin\Ui\Category\Form\DataProviderPlugin->aroundGetMeta(&Magento\Catalog\Model\Category\DataProvider\Interceptor#000000001086adbc000000002644233d#, &Closure#000000001086adf1000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#21 Magento\Catalog\Model\Category\DataProvider\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#22 Magento\Catalog\Model\Category\DataProvider\Interceptor->___callPlugins('getMeta', array(), NULL) called at [generated/code/Magento/Catalog/Model/Category/DataProvider/Interceptor.php:26]
#23 Magento\Catalog\Model\Category\DataProvider\Interceptor->getMeta() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:318]
#24 Magento\Framework\View\Element\UiComponentFactory->mergeMetadata('category_form', array('category_form' => array('attributes' => array('name' => 'category_form', 'class' => 'Magento\Ui\Compo...'), 'arguments' => arr
#25 Magento\Framework\View\Element\UiComponentFactory->create('category_form', NULL, array('context' => &Magento\Framework\View\Element\UiComponent\Context#000000001086adf6000000002644233d#, 'structure' => &Magento\Framework\View\Layout\Data\Structure#000000001086a9e7000000002644233d#)) called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:140]
#26 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent(&Magento\Framework\View\Layout\Data\Structure#000000001086a9e7000000002644233d#, 'category_form', array('attributes' => array('group' => '', 'component' => '', 'aclResource' => '', 'visibilityCondit...' => array())), &Magento\Framework\View\Layout\Interceptor#000000001086a99d000000002644233d#) called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:103]
#27 Magento\Framework\View\Layout\Generator\UiComponent->process(&Magento\Framework\View\Layout\Reader\Context#000000001086ac60000000002644233d#, &Magento\Framework\View\Layout\Generator\Context#000000001086ac4e000000002644233d#) called at [vendor/magento/framework/View/Layout/GeneratorPool.php:81]
#28 Magento\Framework\View\Layout\GeneratorPool->process(&Magento\Framework\View\Layout\Reader\Context#000000001086ac60000000002644233d#, &Magento\Framework\View\Layout\Generator\Context#000000001086ac4e000000002644233d#) called at [vendor/magento/framework/View/Layout.php:350]
#29 Magento\Framework\View\Layout->generateElements() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:89]
#30 Magento\Framework\View\Layout\Interceptor->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#31 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:55]
#32 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#33 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Layout.php:257]
#34 Magento\Framework\View\Layout->build() called at [vendor/magento/framework/View/Layout.php:882]
#35 Magento\Framework\View\Layout->getBlock('menu') called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:414]
#36 Magento\Framework\View\Layout\Interceptor->getBlock('menu') called at [vendor/magento/module-backend/Model/View/Result/Page.php:26]
#37 Magento\Backend\Model\View\Result\Page->setActiveMenu('Magento_Catalog:...') called at [generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php:24]
#38 Magento\Backend\Model\View\Result\Page\Interceptor->setActiveMenu('Magento_Catalog:...') called at [vendor/magento/module-catalog/Controller/Adminhtml/Category/Edit.php:113]
#39 Magento\Catalog\Controller\Adminhtml\Category\Edit->execute() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Category/Edit/Interceptor.php:24]
#40 Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
#41 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/module-backend/App/AbstractAction.php:231]
#42 Magento\Backend\App\AbstractAction->dispatch(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#43 Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#44 Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#45 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(&Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor#000000001086af35000000002644233d#, &Closure#000000001086af22000000002644233d#, &Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#46 Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#47 Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#), NULL) called at [generated/code/Magento/Catalog/Controller/Adminhtml/Category/Edit/Interceptor.php:39]
#48 Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/App/FrontController.php:159]
#49 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#, &Magento\Catalog\Controller\Adminhtml\Category\Edit\Interceptor#000000001086af35000000002644233d#) called at [vendor/magento/framework/App/FrontController.php:98]
#50 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#51 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#52 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#53 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#), array(array('default_store_se...', 'page_cache_from_...', 'storeCookieValid...', 'install', 'configHash'))) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#54 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000001086aa52000000002644233d#) called at [vendor/magento/framework/App/Http.php:116]
#55 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#56 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http#000000001086aa20000000002644233d#) called at [pub/index.php:40]

I have removed modules and have third party extensions however compilation runs fine and not much other than smile elastic suite seems to be getting involved here.

UPDATE

So that theme creation seems to be running 10 times over, first time correctly then every time after incorrectly. Commenting out the throw Exception loads the page seemingly fine. The second time and each run after it runs is where the problem starts and seemingly this shouldn't be running from backend with Area::AREA_FRONTEND:

Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager

                'theme' => $this->themeFactory->create(
                    $this->design->getConfigurationDesignTheme(Area::AREA_FRONTEND)

I have removed the smile plugin and issue still occurs with only Magento core showing in the trace. Disabling an extremely simple admin theme that just adds a logo however seems to fix it.

Another workaround that seems to work for me is adding a frontend theme within the adminhtml di.xml for initialising the admin theme:

Vendor/ModuleAdminTheme/etc/edminhtml/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- Admin theme. Start -->
<type name="Magento\Theme\Model\View\Design">
    <arguments>
         <argument name="themes" xsi:type="array">
             <item name="adminhtml" xsi:type="string">Buzz/BuzzLumaAdmin</item> <!-- Example: "Magento/backend" -->
             <item name="frontend" xsi:type="string">Buzz/BuzzLuma</item> <!-- Example: "Magento/backend" -->
         </argument>
     </arguments> 
</type>
<!-- Admin theme. End -->
</config>

Therefore allowing atleast a theme to be found in this case where that LayoutUpdateManager looks for a frontend theme whilst in the backend. I'm guessing this if (!$this->layoutProcessor) should fail return false and therefore not create a theme but in case of a custom theme no layoutProcessor is found for some reason.

I am interested to see if a vanilla instance with a basic custom theme as per https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/admin_theme_apply.html even works anymore and weather to submit as a bug however have little time at present.

Best Answer

you add wrong path for di.xml

Before

Vendor/ModuleAdminTheme/etc/edminhtml/di.xml

After

Vendor/ModuleAdminTheme/etc/di.xml
Related Topic