60

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 at 16:41
  • tried every solution, ended up reinstalling magento – Robert Sinclair yesterday

17 Answers 17

85

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.

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 for theme and you will get path records like design/theme/theme_id replace your default theme id in it.

STEP 3 : Flush cache

Flush your cache php bin/magento cache:flush

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

  • 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
27

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

References

  • 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
11

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.

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

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

7

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:
\Magento\Framework\Component\ComponentRegistrar::register(
    'theme',
    'global/Magento/backend',
    $componentRegistrar->getPath('theme', 'adminhtml/Magento/backend')
);

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

Update:

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 */
$state->emulateAreaCode(
    'frontend',
    [$this->accountManagement, 'initiatePasswordReset'],
    [
        $customer->getEmail(),
        AccountManagement::EMAIL_REMINDER,
        $customer->getWebsiteId()
    ]
);

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

  • 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
4

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.

1

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

  • 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
1

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.

1

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
0

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.

  • 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
0

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

enter image description here

0

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

0

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.

0

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.

0

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!

0

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.

-1

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

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.