octobercms/october · error · ApplicationException

Unable to find the active theme.

Error message

Unable to find the active theme.

What it means

Thrown by getCmsPageOptions when findTargetTheme() returns null, i.e. no active theme can be resolved for the current request/backend context. The dropdown options for CMS pages cannot be built without a theme directory to prefix page codes with.

Solutions

  1. Ensure an active theme is configured (Theme settings or cms.activeTheme config) and its directory exists
  2. Clear cached theme resolution if the theme was recently renamed
  3. Check that the CMS module is loaded before using theme-dependent features
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at modules/cms/models/MaintenanceSetting.php:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/3f64e3c98c4fc578. Report an issue: GitHub.

Appendix: source

Thrown at modules/cms/models/MaintenanceSetting.php:91

    {
        if (!System::hasDatabase()) {
            return false;
        }

        if (BackendAuth::userHasAccess('general.backend.view_offline')) {
            return false;
        }

        return self::get('is_enabled', false);
    }

    /**
     * getCmsPageOptions
     */
    public function getCmsPageOptions()
    {
        if (!$theme = $this->findTargetTheme()) {
            throw new ApplicationException('Unable to find the active theme.');
        }

        return array_map(function($code) use ($theme) {
            return "{$theme->getDirName()}/{$code}";
        }, Page::listInTheme($theme)->lists('fileName', 'fileName'));
    }

    /**
     * beforeValidate ensures each theme has its own CMS page, store it inside a mapping array.
     */
    public function beforeValidate()
    {
        if (!$theme = $this->findTargetTheme()) {
            throw new ApplicationException('Unable to find the active theme.');
        }

        $themeMap = (array) $this->theme_map;
        $themeMap[$theme->getDirName()] = $this->cms_page;

View on GitHub (pinned to b608633a7e)