{"record":{"id":"4962d38b5509af8e","repo":"octobercms/october","slug":"cms-lang-theme-active-is-locked","errorCode":null,"errorMessage":"cms::lang.theme.active.is_locked","messagePattern":"cms::lang\\.theme\\.active\\.is_locked","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/Theme.php","lineNumber":212,"sourceCode":"            throw new SystemException(Lang::get('cms::lang.theme.active.not_set'));\n        }\n\n        return $activeTheme;\n    }\n\n    /**\n     * getActiveTheme returns the active theme object\n     */\n    public static function getActiveTheme(): ?Theme\n    {\n        if (self::$activeThemeCache !== false) {\n            return self::$activeThemeCache;\n        }\n\n        $theme = static::load($themeCode = static::getActiveThemeCode());\n\n        if ($theme->isLocked()) {\n            throw new ApplicationException(Lang::get('cms::lang.theme.active.is_locked', ['theme' => $themeCode]));\n        }\n\n        if (!$theme->isValid()) {\n            return self::$activeThemeCache = null;\n        }\n\n        return self::$activeThemeCache = $theme;\n    }\n\n    /**\n     * setActiveTheme sets the active theme\n     *\n     * The active theme code is stored in the database and overrides the\n     * configuration cms.active_theme config item.\n     */\n    public static function setActiveTheme(string $code)\n    {\n        $theme = static::load($code);","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/Theme.php#L194-L230","documentation":"ApplicationException thrown by `Theme::getActiveTheme()` when the resolved active theme is locked: its directory contains a `.themelock` file (`isLocked()`). Locked themes are treated as non-production templates (the framework's demo themes ship locked), so the CMS refuses to use them for front-end rendering even though the theme itself is valid.","triggerScenarios":"Configuring a demo theme (one that ships `themes/<demo>/.themelock`) as cms.active_theme, or its code being stored on the site record; then requesting any front-end page.","commonSituations":"Enabling the framework demo theme on production to 'quickly show something'; copying a demo theme as a starter without removing the lock file; theme lock file accidentally committed into a custom theme.","solutions":["Switch the active theme to a real, unlocked theme via config or the backend theme picker.","If the theme is genuinely yours, delete the `.themelock` file from its root: `rm themes/<theme>/.themelock`.","Audit copied/starter themes for a stray .themelock before deploying."],"exampleFix":"# before — demo theme locked, cannot be active\n$ ls themes/demo-theme/.themelock\nthemes/demo-theme/.themelock\n\n# after — only if you intend to use it as your production theme\nrm themes/demo-theme/.themelock\n# otherwise pick another theme in the backend","handlingStrategy":"validation","validationCode":"use Cms\\Classes\\Theme;\n\n$theme = Theme::load($code);\nif ($theme->isLocked()) {\n    // refuse before rendering: locked themes are demo-only\n    abort(500, \"Theme '{$code}' is locked and cannot be used as the active theme.\");\n}\n$theme = Theme::getActiveTheme();","typeGuard":null,"tryCatchPattern":"try {\n    $theme = Theme::getActiveTheme();\n} catch (ApplicationException $e) {\n    // locked active theme — page can't render; show maintenance and alert ops\n    Log::critical('Active theme is locked');\n    return response()->view('errors.maintenance', [], 503);\n}","preventionTips":["Check for .themelock before promoting any demo/starter theme to active.","Keep .themelock out of custom themes (review starter-kit copies).","Automate a pre-deploy assertion: active theme code must exist and not be locked."],"tags":["theme","locked-theme","configuration","rendering"],"backgroundTag":"theme-locked","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}