[Fixed] Magento 2 Unable to load theme by specified key error
You have been seeing this error lately. It says "unable to load theme by specified key".
Ouch. So what is the cause of this, and how to fix this?
This article answers both questions above.
The cause of Unable to load theme by specified key error
The root of this error is: you are having one or more theme deleted in your code, but not fully deleted in related table(s) in your site's Database.
There are two common scenarios when you encounter this error.
The first one is when you migrate Magento version 1 to Magento version 2, and the theme you were using did not support Magento version 2.
The second one is when you delete your theme not thoroughly.
Either way, you would be advised to fix the error by one simple way.
The solution for Unable to load theme by specified key error
In order to fix this error, you have to remove the row of the theme with the key in the error log in the core_config_data table.
You can either do this via SSH or SQL Admin tools.
For those of you who are more experienced and want to get things done fast, use SSH.
- Open a Terminal Emulator such as PuTTY. Log in to your SQL account.
- Then input:
delete from core_config_data where path = 'design/theme/theme_id' and value = '<your key>';
- Note: <your key> here is the key in the error log. With the example above, <your key> is 4.
- Then flush cache.
Using a SQL Admin tools
For those of you who prefer a more visual way to fix things, use a SQL Admin tool.
- Open a SQL Admin tool such as Adminer. Log in to your Adminer account.
- Find table named core_config_data.
- Find the row with the path = 'design/theme/theme_id' and value = '<your key>'.
- Then flush cache.
Unable to load theme by specified key error: In conclusion,
This problem is quite common and yet easy to fix. Following this guide should make your website back to normal, without the asynchronicity of the theme files and Database.
If you do migration from Magento version 1 to version 2, hire Magento experts to migrate for you to prevent further hard-to-notice bugs and errors like this.
Do you find this debug guide easy to follow? Do you have any more question? Let us know in the comment below.
Take a look at our gallery of premium and free Magento 2 themes. Click the image below!