{"record":{"id":"c10a6f68e04e1d32","repo":"octobercms/october","slug":"cms-lang-theme-edit-not-found","errorCode":null,"errorMessage":"cms::lang.theme.edit.not_found","messagePattern":"cms::lang\\.theme\\.edit\\.not_found","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/Page.php","lineNumber":97,"sourceCode":"    /**\n     * getCodeClassParent returns name of a PHP class to us a parent for the PHP class\n     * created for the object's PHP section.\n     * @return mixed Returns the class name or null.\n     */\n    public function getCodeClassParent()\n    {\n        return PageCode::class;\n    }\n\n    /**\n     * getLayoutOptions returns a list of layouts available in the theme.\n     * This method is used by the form widget.\n     * @return array Returns an array of strings.\n     */\n    public function getLayoutOptions()\n    {\n        if (!($theme = Theme::getEditTheme())) {\n            throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));\n        }\n\n        $layouts = Layout::listInTheme($theme, true);\n        $result = [];\n        $result[''] = Lang::get('cms::lang.page.no_layout');\n\n        foreach ($layouts as $layout) {\n            $baseName = $layout->getBaseFileName();\n\n            if (FileDefinitions::isPathIgnored($baseName)) {\n                continue;\n            }\n\n            $result[$baseName] = strlen($layout->name) ? $layout->name : $baseName;\n        }\n\n        return $result;\n    }","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/Page.php#L79-L115","documentation":"ApplicationException thrown by `Page::getLayoutOptions()` (the form-widget source for the Layout dropdown) when `Theme::getEditTheme()` returns null — no editable theme could be resolved for the backend. This means the theme configuration itself is broken: no theme for the current site, no valid backend preference, and no usable active theme.","triggerScenarios":"Opening the page create/edit form when `themes/` is empty, the configured active theme folder doesn't exist, or the backend user's saved theme preference points at a deleted theme.","commonSituations":"Fresh installs that were never given a theme; cms.active_theme config pointing at a renamed theme; theme directory removed in a deploy; environment config (.env) missing so the wrong theme code resolves.","solutions":["Set the active theme in config/cms.php ('active_theme' => 'mytheme') or via the backend theme picker so an edit theme resolves.","Ensure `themes/mytheme/` actually exists with a valid theme.json and matches the configured code.","Reset the stuck backend preference by re-selecting a theme in the backend (or clearing the user preference) if it references a deleted theme."],"exampleFix":"// config/cms.php — before\n'active_theme' => '',\n\n// after — must match a directory under themes/\n'active_theme' => 'mytheme',","handlingStrategy":"validation","validationCode":"use Cms\\Classes\\Theme;\n\nif (!Theme::getEditTheme()) {\n    // don't build the page form at all without a resolvable edit theme\n    abort(500, 'No editable theme configured. Set cms.active_theme first.');\n}\n// safe to call $page->getLayoutOptions()","typeGuard":null,"tryCatchPattern":"try {\n    $options = $page->getLayoutOptions();\n} catch (ApplicationException $e) {\n    // degrade gracefully: render form without the layout dropdown\n    $options = ['' => 'No theme available'];\n    Log::error('Layout options unavailable: ' . $e->getMessage());\n}","preventionTips":["Health-check the theme configuration in a boot-time check on admin routes.","Validate that the configured theme code matches an existing folder during deployment.","When renaming a theme directory, update cms.active_theme and backend preferences in the same change."],"tags":["theme","configuration","backend","form-widget"],"backgroundTag":"theme-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}