Title: Error: Failed to generate cache
Last modified: January 9, 2025

---

# Error: Failed to generate cache

 *  Resolved [jayhoo](https://wordpress.org/support/users/jayhoo/)
 * (@jayhoo)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/error-failed-to-generate-cache/)
 * Hello,
 * I installed this plugin and want to add Tailwind to my Custom Theme (a blank 
   theme [https://underscores.me/](https://underscores.me/))
 * I already added th Scanner code into my functions.php file following this document
   [https://wind.press/docs/integrations/custom-theme](https://wind.press/docs/integrations/custom-theme)
 *     ```wp-block-code
       <?php/** * @param array $providers The collection of providers that will be used to scan the design payload * @return array */function register_my_theme_provider(array $providers): array {    $providers[] = [        'id' => 'uu_dam', // The id of this custom provider. It should be unique across all providers        'name' => 'My Theme Scanner',        'description' => 'Scans the current active theme and child theme',        'callback' => 'scanner_cb_my_theme_provider', // The function that will be called to get the data. Please see the next step for the implementation        'enabled' => \WindPress\WindPress\Utils\Config::get(sprintf(            'integration.%s.enabled',            'uu_dam' // The id of this custom provider        ), true),    ];    return $providers;}add_filter('f!windpress/core/cache:compile.providers', 'register_my_theme_provider');
       ```
   
 * and
 *     ```wp-block-code
       <?phpfunction scanner_cb_my_theme_provider(): array {    // The file with this extension will be scanned, you can add more extensions if needed    $file_extensions = [        'php',        'js',        'html',    ];    $contents = [];    $finder = new \WindPressDeps\Symfony\Component\Finder\Finder();    // The current active theme    $wpTheme = wp_get_theme();    $themeDir = $wpTheme->get_stylesheet_directory();    // Check if the current theme is a child theme and get the parent theme directory    $has_parent = $wpTheme->parent() ? true : false;    $parentThemeDir = $wpTheme->parent()->get_stylesheet_directory() ?? null;    // Scan the theme directory according to the file extensions    foreach ($file_extensions as $extension) {        $finder->files()->in($themeDir)->name('*.' . $extension);        if ($has_parent) {            $finder->files()->in($parentThemeDir)->name('*.' . $extension);        }    }    // Get the file contents and send to the compiler    foreach ($finder as $file) {        $contents[] = [            'name' => $file->getRelativePathname(),            'content' => $file->getContents(),        ];    }    return $contents;}
       ```
   
 * But when i press Generate Cache button then it’s showing this notification:
   Error:
   Failed to generate cacheCan you tell me what’s missing here?Thanks,Jay

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [jayhoo](https://wordpress.org/support/users/jayhoo/)
 * (@jayhoo)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-failed-to-generate-cache/#post-18235616)
 * I found the issue, we should be change
 *     ```wp-block-code
       $parentThemeDir = $wpTheme->parent()->get_stylesheet_directory() ?? null;
       ```
   
 * to
 *     ```wp-block-code
       $parentThemeDir = $has_parent ? $wpTheme->parent()->get_stylesheet_directory() : null;
       ```
   
 *  Plugin Author [Sua](https://wordpress.org/support/users/suabahasa/)
 * (@suabahasa)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/error-failed-to-generate-cache/#post-18243198)
 * Hi [@jayhoo](https://wordpress.org/support/users/jayhoo/),
 * Thank you, we have update our Docs with the change you suggest.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Error: Failed to generate cache’ is closed to new replies.

 * ![](https://ps.w.org/windpress/assets/icon-256x256.png?rev=3142560)
 * [WindPress - Tailwind CSS integration for WordPress](https://wordpress.org/plugins/windpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/windpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/windpress/)
 * [Active Topics](https://wordpress.org/support/plugin/windpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/windpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/windpress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Sua](https://wordpress.org/support/users/suabahasa/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/error-failed-to-generate-cache/#post-18243198)
 * Status: resolved