Magento 2 – Error – Exception #0 (LogicException): Unable to load theme by specified key: ‘4’

After renaming a custom Magneto 2 theme folder, to correct a capitalisation mistake, I ran into all sorts of issues, starting with this error:

Required parameter ‘theme_dir’ was not passed

After reading around I removed the entry from the database table “themes” and tried to set any pages or stores set to use that theme to use something else.  Then I endlessly got this:

Error – Exception #0 (LogicException): Unable to load theme by specified key: ‘4’

ID 4 was the id of the theme I removed from the DB.

When trying to change the theme configuration in the Admin I would be presented with

Something went wrong while saving this configuration: Unable to load theme by specified key: ‘4’


In the end I searched through some likely looking database tables to look for theme references.

The first was an entry in the core_config_data table, found by doing SELECT * FROM [magento2].core_config_data WHERE path LIKE ‘%theme%’;   There I saw an entry with design/theme/theme_id   4 .  Changed that to that of another theme.

There was also a reference to the rogue id in the design_config_grid_flat  table and also one in the cms_page table.

Sorting all these out sorted the error….phew…

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Apply your human brain cells and complete this highly complicated maths problem *