octobercms/october · error · ApplicationException
cms::lang.theme.edit.not_found
Error message
cms::lang.theme.edit.not_found
What it means
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.
Source
Thrown at modules/cms/classes/Page.php:97
/**
* getCodeClassParent returns name of a PHP class to us a parent for the PHP class
* created for the object's PHP section.
* @return mixed Returns the class name or null.
*/
public function getCodeClassParent()
{
return PageCode::class;
}
/**
* getLayoutOptions returns a list of layouts available in the theme.
* This method is used by the form widget.
* @return array Returns an array of strings.
*/
public function getLayoutOptions()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$layouts = Layout::listInTheme($theme, true);
$result = [];
$result[''] = Lang::get('cms::lang.page.no_layout');
foreach ($layouts as $layout) {
$baseName = $layout->getBaseFileName();
if (FileDefinitions::isPathIgnored($baseName)) {
continue;
}
$result[$baseName] = strlen($layout->name) ? $layout->name : $baseName;
}
return $result;
}View on GitHub (pinned to b608633a7e)
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.
Example fix
// config/cms.php — before 'active_theme' => '', // after — must match a directory under themes/ 'active_theme' => 'mytheme',
Defensive patterns
Strategy: validation
Validate before calling
use Cms\Classes\Theme;
if (!Theme::getEditTheme()) {
// don't build the page form at all without a resolvable edit theme
abort(500, 'No editable theme configured. Set cms.active_theme first.');
}
// safe to call $page->getLayoutOptions() Try / catch
try {
$options = $page->getLayoutOptions();
} catch (ApplicationException $e) {
// degrade gracefully: render form without the layout dropdown
$options = ['' => 'No theme available'];
Log::error('Layout options unavailable: ' . $e->getMessage());
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- cms::lang.theme.edit.not_set
- cms::lang.theme.active.not_set
- cms::lang.theme.active.is_locked
- Cannot delete the active theme, try making another theme act
- cms::lang.template.not_found
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/c10a6f68e04e1d32.
Report an issue: GitHub.