What is the error message:

Required parameter 'theme_dir' was not passed

Is it related to in Magento 2? And how can this problem be fixed?

  • i fixed this by changing permission of theme folder – taoufiqaitali Jun 19 '19 at 16:41
  • tried every solution, ended up reinstalling magento – Robert Sinclair Oct 16 '19 at 14:43

22 Answers 22


Just in case if you are removing theme directly(Not in Magento way).

Then follow these steps.

STEP 1 : File Operations

Delete the content from app/design/frontend/<Vendor> (make sure you back it up first).

Delete all the content of folder var/view_preprocessed & pub/static/frontend.

rm -rf var/view_preprocessed/* pub/static/frontend/*

STEP 2 : DB Operations

Go to your theme table and delete the entry for your created theme.

After that...

Go to your core_config_data table and search the column path for design/theme/theme_id

SELECT * FROM core_config_data WHERE path = "design/theme/theme_id"

and replace your default theme id in it.

STEP 3 : Flush cache

Flush your cache php bin/magento cache:flush

It is very important that you follow all the steps first before trying to change the design in the backend! Otherwise it won't work.

Let me know if you still face any problems after that.

| improve this answer | |
  • Thanks. I had the same problem when I deleted a theme. Don't forget to delete the remnants left in the database. I did fix the theme-table, but forgot about the core_config_data value. – Giel Berkers Mar 14 '17 at 10:48
  • @GielBerkers : Welcome :) – Kaushal Suthar Mar 14 '17 at 11:07
  • @KaushalSuthar this didn't worked at all instead the admin went into text format. Then after running setup:static-content:deploy admin went back to UI. – Ashwani Shukla Oct 24 '17 at 15:09
  • @AshwaniShukla : you might have made some mistake during the process... – Kaushal Suthar Oct 25 '17 at 6:53
  • @KaushalSuthar the only mistake I made was pub/static/.htaccess was not there. thanks – Ashwani Shukla Nov 1 '17 at 14:38

This error message means that you have a theme configured which doesn't exist on the file-system (any more).

It can be easily fixed by selecting a valid theme instead. Go to Content -> Configuration, select the scope (global, website, store_view) and change the theme. After you've done that you should also remove it from Content -> Themes.

change theme for store


| improve this answer | |
  • This can also be the case if your theme directory does not have the proper permissions. – Nathan Moinvaziri Sep 26 '16 at 16:16
  • Permissions should be checked by some of the Magento scripts AFAIK, but you're right, this qualifies as the same: An inaccessible directory often behaves similar to a non-existing directory. – hakre Oct 1 '16 at 8:08
  • 3
    This is no longer the place this is located. its in the content tab now. – CarComp Dec 5 '16 at 15:24
  • @CarComp: Feel free to provide an updated screenshot and edit the answer. When I answered, it was as documented. – hakre Dec 5 '16 at 15:37
  • @hakre, does not work. It still shows the error, even after switching to Magento Base. – Black Jan 28 at 16:51

In my case I deleted a child theme from Vendor directory. But the DB entry was still there in theme table. So go to the theme table and delete the record that points to deleted theme.

| improve this answer | |
  • How did you delete from the vendor directory? With composer by composer remove vendor/theme ? – hakre Aug 22 '16 at 6:37
  • No, just rm -rf vendor/theme – Arvind07 Aug 22 '16 at 7:16

This problem can also occur when you're in an emulated state, for example in a CLI command. I had a situation where I could not send an e-mail in the CLI, because the wrapping command was running in an emulated state:

$this->appState->emulateAreaCode(AppArea::AREA_GLOBAL, function() {
    // In this section the email was sent

In the above example, when the e-mail was trying to determine it's template dir, it would map to global/Magento/backend, which is non-existent. To fix this, I had to manually add it in my constructor:

/** @var \Magento\Framework\Component\ComponentRegistrarInterface $componentRegistrar */
// Make the admin theme global accessible for sending e-mails:
    $componentRegistrar->getPath('theme', 'adminhtml/Magento/backend')

After this fix, the issue was solved and I could send the e-mail.


When it comes to sending mail using the CLI, a more proper approach would be to use emulation. For example:

/** @var Magento\Framework\App\State $state */
    [$this->accountManagement, 'initiatePasswordReset'],

This way you don't have to your dirty little hacks.

| improve this answer | |
  • Thanks for sharing in this depth. This answer quite becomes a FAQ on it's own, very nice to see. – hakre Jan 8 '18 at 21:14

Make sure theme table entry & magento\app\design\frontend\<Vendor> Entry will be same.

If not it causes this issue.

Remove unnecessary theme via Admin -> Content -> Design -> Themes. Delete It. So it will remove DB Entry as well.

If u only remove folder then it will not work

| improve this answer | |

run sql UPDATE core_config_data SET value=NULL WHERE path='design/theme/theme_id'

then clear the pub/static/frontend, var/view_preprocessing, var/cache, var/page_cache directories.

| improve this answer | |

@hakre is correct. I got the same error Required parameter 'theme_dir' was not passed. Below I explain what I did to cause the error:

I creating a theme in app/design/frontend/MyVendorTheme2/myThemeName2 directory, and then configured it by selecting the theme "MyVendorTheme2 - myThemeName2" in the Magento 2 Admin browser (Stores > Configuration > THEME SETTINGS > GENERAL > Design > Design Theme). But I then decided to move the "myThemeName2" directory (containing my new theme) to be under a different (existing) vendor folder "MyVendorTheme1" app/design/frontend/MyVendorTheme1/myThemeName2, and removed it from the "MyVendorTheme2" folder where it was before. I proceeded to compile assets (i.e. grunt clean, grunt exec:myThemeName2, grunt less:myThemeName2), and then opened my browser at my theme subdomain (i.e. http://myvirtualhostdomain:myport/myvendortheme1_mythemename2_magento2_quickstart/).

Initially I got an unspecified error: There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number:

I enabled error reporting by renaming pub/errors/local.xml.sample to local.xml, and refreshed the page. I was then presented with the error Required parameter 'theme_dir' was not passed.

I resolved the error by going back into my Magento 2 Admin browser (Stores > Configuration > THEME SETTINGS > GENERAL > Design > Design Theme), which had my previous and now invalid design theme selected, so I chose the correct one.

| improve this answer | |
  • I get this error only when adding 'cache' for redis configuration to the env.php. Remove the changes, and it works fine. So why is it only when adding 'cache'? I checked the syntax of the array and it's fine. The same cache => value is working on my staging server (cut/pasted) – Scott May 30 '18 at 10:54

This error happened to me when saving product images after installing a custom theme.

I had the custom theme that was set as a virtual type, that is in the DB in theme table, type = 1. In my case I wasn't using the theme anymore so I deleted it from the table.

| improve this answer | |

1 - Use the command below to identify the themes in the admin panel.

n98-magerun2 dev:theme:list

2 - Run the command to identify the installed themes:

ls -lha app/design/frontend/MyThemePackage/

3- Run these commands below to create the theme that doesn't exist:

n98-magerun2 deploy:mode:set developer
n98-magerun2 dev:console
make:theme frontend MyThemePackage MyThemeName
| improve this answer | |

I know this question is quite old, but since I ran into this just today and quickly found out what my problem was, I decided to post my answer as a reminder for all of those that, like me, use PhpStorm to work with Magento: remember to check out your files when switching branches.

In my case, the branch that I was working on didn't had the required theme files (they got stashed by PhpStorm when I changed from the theme branch to the master branch) because they hasn't been merged on it yet, thus the error.

Hope this might help someone.

| improve this answer | |

Go to your core_config_data table and search for theme and you will get path record like


replace your default theme id in it. Also flush cache after that.

| improve this answer | |

I had such problem in my cron and CLI command. I was trying to create order and invoice programmatically with sending email to the customer. The solution for this is emulating correct area:

$this->appState->emulateAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND, function() {});

It works well with frontend area.

| improve this answer | |

If nothing has worked, don't forget to check the categories section. There is a design settings there too. Make sure that the correct design theme is assigned. In my case, I was getting the error only on some categories.

| improve this answer | |
  • Could you please provide an example scenario where this issue might occur? The only one I can think of is if layout was changed to an option which only exists within a custom theme, then the theme is removed. But, if this were to occur whilst only using default layouts (or modified versions of the defaults, using the same name), then it surely implies a fault with the custom theme and not with the magento software itself? – Joshua Flood Apr 22 '18 at 14:42

When you are adding or editing product then Go to Design section and change layout option.

enter image description here

| improve this answer | |

You can remove the unused theme from DB directly by executing this below query:

delete from theme where theme_path in ('unusedtheme');

whene unusedtheme is the unused theme, and after you will clena your cache

| improve this answer | |

I had this issue when i removed by accident app/desing/adminhtml/theme-name folder. Bringing it back resolved my issue. Moreover it only occured when i tried to enter Admin Panel.

| improve this answer | |

In some cases you delete custom theme in-proper way then you will also face this error. In this situation:

1) you have to delete that entry/row from 'theme' table.
2) set value 1 (1 for blank theme 2 for Luma what ever you want to set) against 'design/theme/theme_id'

Refresh the page error gone.

| improve this answer | |

I resolved the issue. In my case the problem was not Magento2 but a wrong operation I did time ago as follow: I created a theme creating the relative path in app/design/frontend/MyFolder/MyTheme and registered it as explained in Magento 2 online documentation. Then I decided to cancel the theme and instead to use the appropriate command: bin/magento theme:uninstall frontend/MyFolder/MyTheme I deleted the folders directly. This is not a good operation as the database is not updated with the due information. Solution: with an editor of database as phpmyadmin, delete the record in the table "Theme" corrisponding to the deleted folders. I hope this will help!

| improve this answer | |
rm -rf var/cache/*
rm -rf var/view_preprocessed/
rm -rf generated/*
rm -rf pub/static/*
sudo chmod -R 777 .

it should help.

| improve this answer | |

This happened to me when I was emulating the Crontab area code for a specific email-sending job during testing (which is what I want to emulate since it is a cron job).

Look at the following (abbreviated) stack trace of 2.3.3:

This was trying to resolve the $componentName of crontab/Magento/theme-blank (which doesn't exist). I solved this by emulating the frontend (since that is where my email should be emulated from).


use Magento\Framework\App\Area;
use Magento\Framework\App\State;

// ...

/** @var State */
private $state;

// ...

$this->state->emulateAreaCode(Area::AREA_FRONTEND, function () {
    // This includes my logic that was causing the exception.
| improve this answer | |

This error happens when you change/remove a theme folder but did not remove theme from database. I follow this tutorial and successfully fix this issue

To fix this error, you can update theme data in database, remove entry or update path using this command

mysql -u <dbuser> -p -e "delete from <dbname>.theme where theme_path ='<Vendorname>/<themename>' AND area ='frontend' limit 1"

Replace the following information

  • dbuser: database username

  • dbname: database name

  • Vendor/theme: path to the theme directory, for example

You can also uninstall theme properly using Magento 2 CLI

bin/magento theme:uninstall --clear-static-content frontend/Magento/blank
| improve this answer | |

delete all the theme temporary files which is not using on website and delete also from the theme which is not using and run cache:flush

| 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.