# \[BUG\] Theme with invalid config.json breaks entire Themes section in Mautic 5.x - Critical Error ThemeHelper::shouldLoadTheme()

**URL:** https://forum.mautic.org/t/bug-theme-with-invalid-config-json-breaks-entire-themes-section-in-mautic-5-x-critical-error-themehelper-shouldloadtheme/34448
**Category:** Product Support
**Created:** [December 14, 2024, 7:18pm UTC](https://forum.mautic.org/t/bug-theme-with-invalid-config-json-breaks-entire-themes-section-in-mautic-5-x-critical-error-themehelper-shouldloadtheme/34448 "2024-12-14T19:18:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sdoering](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sdoering/32/8909_2.png) [@sdoering](https://forum.mautic.org/u/sdoering)
#### Post date: [December 14, 2024, 7:18pm UTC](https://forum.mautic.org/t/bug-theme-with-invalid-config-json-breaks-entire-themes-section-in-mautic-5-x-critical-error-themehelper-shouldloadtheme/34448/1 "2024-12-14T19:18:15Z")

</div>

Here’s a bug report following the template for your Mautic theme issue:

**Your software**  
My Mautic version is: 5.x  
My PHP version is: 8.2.26  
My Database type and version is: 10.11.10-MariaDB-ubu2204

**Your problem**  
My problem is: The themes section in Mautic becomes inaccessible after uploading a custom theme. When trying to access the themes section, Mautic throws a critical error. Additionally, uploading new themes fails with a TypeError regarding null config.

These errors are showing in the log:

```auto
[2024-12-14T19:05:37.530306+00:00] mautic.CRITICAL: Uncaught PHP Exception TypeError: "Mautic\CoreBundle\Helper\ThemeHelper::shouldLoadTheme(): Argument #1 ($config) must be of type array, null given, called in /var/www/vhosts/chop.de/mautic/web/app/bundles/CoreBundle/Helper/ThemeHelper.php on line 493" at /var/www/vhosts/chop.de/mautic/web/app/bundles/CoreBundle/Helper/ThemeHelper.php line 526 {"exception":"[object] (TypeError(code: 0): Mautic\\CoreBundle\\Helper\\ThemeHelper::shouldLoadTheme(): Argument #1 ($config) must be of type array, null given, called in /var/www/vhosts/chop.de/mautic/web/app/bundles/CoreBundle/Helper/ThemeHelper.php on line 493 at /var/www/vhosts/chop.de/mautic/web/app/bundles/CoreBundle/Helper/ThemeHelper.php:526)"} {"hostname":"lycana.chop.de","pid":1020531}

```

Steps I have tried to fix the problem:

- Verified JSON syntax of config.json
- Checked file permissions
- Attempted to reupload the theme
- Cleared Mautic cache

The only solution currently is to manually delete the theme directory from the filesystem at `themes/[theme-name]` since the themes section in the UI is inaccessible due to this error.

This appears to be a bug in Mautic’s theme handling where an invalid or unreadable config.json file in a theme not only prevents that theme from loading but also breaks the entire themes section of Mautic, requiring filesystem-level intervention to resolve.
