Is the "Required parameter 'theme_dir' was not passed" issue still valid? Let's fix together.

Is the "Required parameter 'theme_dir' was not passed" issue still valid? Let's fix together

Let’s talk about how to fix one of Magento 2 errors. Customers often ask why their theme has been indicated as virtual. Then the following error comes: "Required parameter 'theme_dir' was not passed".

Today we share with you a step by step tutorial to help you resolve the problem. You will also see the recommendation to prevent the issue.

Why is your Magento 2 theme as “virtual” indicated?

The Required parameter ‘theme_dir’ was not passed error is caused by corrupted theme files. So how could it happen? There are a few scenarios of the issue.

  • You started to download the theme files. And while some files are still generated halfway the uploading, Magento determined your template as already set in the database. Then it couldn’t find a part of the files in the code for your theme. There Magento 2 shows your theme as virtual.
  • The error can come on a journey when you're updating a theme in the wrong way (Part of theme files become invisible to your webserver). Till you didn't enable maintenance mode on your site, Magento could change your theme to Virtual.
  • When experimenting with the look of an eCommerce website you might like to override a theme or completely remove it. Most users delete all the files incorrectly. They delete theme folders directly from app/design or vendor/ directory. However, there is separate entry for your theme in Magento database table. So, there are still some points related to the theme left in the database. And this is the most frequent situation when the "Required parameter ‘theme_dir’ was not passed" problem occurs.

Well, before we show you how to resolve this common Magento 2 error, let us mention here...

How to remove theme from Magento 2?

You have to remove a theme through a separate uninstall command. Magento provides you with step-by-step instructions to delete theme from system.

Besides using bin/magento theme:uninstall command, you can also manually remove theme record from the database table “theme”. It will be helpful in case you already deleted the directory structure. Ultimately, everything will be fine.

Alright, now you should remember that the theme in the Magento database is marked as virtual even if you have recovered and deleted everything. In order to fix the "Required parameter 'theme_dir' was not passed" problem we are gonna make changes only in the database.

How to fix “Required parameter 'theme_dir' was not passed” issue?

We decided to create this tutorial after multiple requests by new customers of the Argento template. The error happens sometimes during the upgrade from other Magento 2 themes to Argento.

Here are 2 ways to fix the error.

1/ If your theme files are in place with fully webserver read access, but the error still shows, please do as follows:

  • Go to PhpMyAdmin > Your Magento2 database
  • Find the "theme" table
  • Set your theme type to '0' (Physical theme) (Or remove the record)
  • Save the changes

2/ If your theme is still indicated as Virtual, we highly recommend you to to remove all theme files (app/design or vendor folders) and theme records from the database. Don't forget to unset the theme from core_config_data table. To do that, please navigate to Admin - Content - Design - Configuration. In the end you must ensure the broken theme is not used per any store view. Then the Magento error will be never shown again.

So now you could see a solution to the problem. We hope our guide provided answers to many questions.

In case you still have questions, please get in touch. Post comments here, or Contact us.

Leave a Reply