Solved: How to fix required parameter ‘theme_dir’ was not passed?

Solved: How to fix required parameter ‘theme_dir’ was not passed?

Why does this happen?

This error is normally returned when you remove your Magento theme directly from app/design or vendor/ directory. Removing theme files directly from the directory is not a Magento standard way anymore. Magento 2 has a CLI command to remove themes safely i.e.

Command usage:

magento theme:uninstall [--backup-code] [-c|--clear-static-content] {theme path} ... {theme path}
  • {theme path} is the relative path to the theme, starting with the area name. For example, the path to the Blank theme supplied with Magento 2 is frontend/Magento/blank.
  • --backup-code backs up the Magento 2 codebase as discussed in the paragraphs that follow.
  • --clear-static-content cleans generated static view files, which is necessary to cause static view files to display properly.

Solution

STEP 1 : File Operations

  • Delete the content from app/design/frontend/<Vendor>.
  • 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. You can run the following command in PHPMyadmin or your database CLI.

SELECT * FROM `core_config_data` WHERE `path` LIKE '%design/theme/theme_id%'

STEP 3 : Flush cache

Flush your cache php bin/magento cache:flush