Im getting errors after I done a fresh install to magento 2.1.6 and relinked to old DB. Now when I select certain items in the menu it will throw this error. I went to DB and changed the theme ID over but then it goes from Key 6 to Key 4.

What can i do to fix this problem

Any help is greatly appreciated.

a:4:{i:0;s:42:"Unable to load theme by specified key: '6'";i:1;s:9519:"

#0 /home/www/public_html/vendor/magento/module-theme/Model/View/Design.php(148): 
Magento\Framework\View\Design\Theme\FlyweightFactory->create('6', 'frontend')

enter image description here

enter image description here

  • I guess there are some problems in your theme, add your theme table screen shot for check theme issue. – Suresh Chikani Apr 29 '17 at 18:08

See if you have saved the theme in products or categories. In product attribute group 'Schedule Design Update', attribute New Theme, attribute code custom_design. Also check categories attribute 'Custom Design', attribute code custom_design.

You need to update the products and categories data for this attribute in database.

`SELECT * FROM eav_attribute WHERE attribute_code = "custom_design";`

There are 2 entries, 1 from product and 1 from category.

`SELECT * from catalog_product_entity_varchar WHERE attribute_id = product custom design attribute id ;`

`SELECT * from catalog_category_entity_varchar WHERE attribute_id = category custom design attribute id ;`

Most likely you didn't set on purpose the Schedule Design on products. You can delete the entries in catalog_product_entity_varchar on attribute id custom_layout.

The same to catalog_category_entity_varchar. Or update with empty string/null in these 2 tables. Or set the new theme id, if you set those values on purpose.

Usually the theme id is in products or categories because product imports or other mass action.

Last, reindex all and flush cache.

Also, widgets can have the theme id set. SELECT theme_id FROM widget_instance; Cms pages: SELECT custom_theme FROM cms_page;

Check 'design_*' tables too.

An extra thing to do would be to dump the structure of the database and search on word 'theme'.

| improve this answer | |
  • Thanks for getting back to so quickly. I have searched the DB with your mentioned comment but I am not very sure if I found the right tables. Do I need to update these rows? See my original post for the screenshot – AlanM Apr 30 '17 at 0:19
  • Actually, I just fixed it up but now some products are showing normally and others are just displaying RTL because I assigned id 6 to the RTL theme so the error disappeared. How can I fix this up now any tips? – AlanM Apr 30 '17 at 1:17
  • 1
    SELECT * from catalog_category_entity_varchar WHERE attribute_id = 60; These 2 queries will display the products with theme id in custom_layout field/attribute. If you delete those rows or update them with the correct theme_id, it's up to you. – obscure Apr 30 '17 at 7:11
  • 1
    This is the comment. I'll write the DELETE MySQL query. You don't need to update/delete rows in eav_attribute table. But please note to take responsibility when you run it on your server. DELETE FROM catalog_product_entity_varchar WHERE attribute_id = 60 ; – obscure Apr 30 '17 at 11:15
  • 1
    Run the delete command if you want the theme_id out from products. If you just want to change the old theme_id with the new one you can run update instead. UPDATE catalog_product_entity_varchar SET value="CORRECT_THEME_ID" WHERE attribute_id = 60 and value > 0. Please replace CORRECT_THEME_ID with the theme id you want. Run indexer and cache flush. – obscure Apr 30 '17 at 11:19

First, check the theme ID in the core config table. As mentioned in the screenshot.

Run basic commands like.

rm -r pub/static/* var/view_preprocessed/* var/cache/* var/di var/generation
bin/magento cache:clean
bin/magento cache:flush
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy

If still error is persisting, Then Update category and product theme section because category and products are attached to the theme that is already moved.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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