{"record":{"id":"ac8b75bbfa74d715","repo":"octobercms/october","slug":"cms-lang-theme-edit-not-set","errorCode":null,"errorMessage":"cms::lang.theme.edit.not_set","messagePattern":"cms::lang\\.theme\\.edit\\.not_set","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/Theme.php","lineNumber":300,"sourceCode":"         *\n         */\n        $apiResult = Event::fire('cms.theme.getEditTheme', [], true);\n        if ($apiResult !== null) {\n            return $apiResult;\n        }\n\n        $editTheme = self::getEditThemeCodeFromPreference();\n\n        if (!$editTheme) {\n            $editTheme = Config::get('cms.edit_theme');\n        }\n\n        if (!$editTheme) {\n            $editTheme = static::getActiveThemeCode();\n        }\n\n        if (!$editTheme) {\n            throw new SystemException(Lang::get('cms::lang.theme.edit.not_set'));\n        }\n\n        return $editTheme;\n    }\n\n    /**\n     * getEditThemeCodeFromPreference\n     */\n    protected static function getEditThemeCodeFromPreference()\n    {\n        // Check for environment\n        if (App::runningInConsole()) {\n            return null;\n        }\n\n        // Check for auth markers\n        if (!BackendAuth::hasSession() && !BackendAuth::hasRemember()) {\n            return null;","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/Theme.php#L282-L318","documentation":"Thrown by Theme::getEditTheme() when Winter CMS cannot determine which theme the backend editor should operate on. The edit theme is resolved in order: the backend user's stored preference, the cms.edit_theme config value, then the active theme code. If all three are empty the exception fires, which almost always means the installation has no active theme configured at all.","triggerScenarios":"Opening any backend area backed by Theme::getEditTheme() (CMS pages/partials/layouts, media, the CMS EditorExtension) on an install where the user has no saved edit-theme preference, config/cms.php defines neither 'edit_theme' nor 'activeTheme', and no active theme code is set in the database.","commonSituations":"Fresh install where no theme was ever activated; config/cms.php missing or with 'activeTheme' commented out; CI/test environments provisioned without theme seeding; the theme/setting rows wiped during a database migration.","solutions":["Set 'activeTheme' => '<theme-dir-name>' in config/cms.php (must match the directory under themes/ exactly)","Activate a theme from the backend (Settings > CMS) so both the active code and the user preference are stored","Verify the theme directory actually exists under themes/ and its name matches the configured code (case-sensitive on Linux)","For programmatic flows, call Theme::setActiveTheme('mysite') before any code path reaches Theme::getEditTheme()"],"exampleFix":"// before (config/cms.php)\n'activeTheme' => null,\n\n// after\n'activeTheme' => 'mysite',","handlingStrategy":"validation","validationCode":"$code = Config::get('cms.edit_theme') ?? \\Cms\\Classes\\Theme::getActiveThemeCode();\nif (!$code) {\n    // configure a theme or abort before any CMS backend code runs\n    throw new RuntimeException('No CMS theme configured: set cms.activeTheme in config/cms.php');\n}","typeGuard":null,"tryCatchPattern":"try { $editTheme = \\Cms\\Classes\\Theme::getEditTheme(); } catch (\\System\\Classes\\BaseException $e) { $editTheme = \\Cms\\Classes\\Theme::load('mysite'); }","preventionTips":["Always define 'activeTheme' in config/cms.php per environment","Seed a theme activation in deploy scripts and test boots before touching CMS backend APIs","Keep theme directory names identical across environments to avoid case mismatches"],"tags":["cms","theme","configuration","backend","winter-cms"],"backgroundTag":"missing-configuration","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}