Magento – Magento 2.3 – Required parameter ‘theme_dir’ was not passed after applying custom ‘Blank’ theme

adminconfigurationcustom-thememagento2.3

I'm having an issue when applying a custom 'Blank' child theme. I'm running a fresh install of 2.3 on LAMP. I followed the Magento docs with respect to theme.xml and registration.php etc, but after I apply the theme in the admin panel I'm getting this error on the frontend

Exception #0 (InvalidArgumentException): Required parameter 'theme_dir' was not passed

If I try reverting back to the 'blank' theme again in the admin panel, I'm unable to and get this error

Something went wrong while saving this configuration: Required parameter 'theme_dir' was not passed

I'm using a fresh mysql database, so it can't be an old theme in the table issue??

Anyone come across this?

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/webmagento/customtheme',
    __DIR__
);
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Custom Theme</title>
    <parent>Magento/blank</parent>
</theme>

Best Answer

This usually happens when there is a mismatch in themes present in folder structure and themes present in Database "theme" table.

If you are removing theme directly, then follow these steps.

  1. File Operations Delete the content from app/design/frontend/<Vendor>.

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

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

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.

  1. Flush cache Flush your cache php bin/magento cache:flush
Related Topic