octobercms/october · error · ApplicationException
cms::lang.template.not_found
Error message
cms::lang.template.not_found
What it means
loadTemplate() in the editor extension CRUD trait calls <Type>::load($theme, $path) for the resolved template class; a falsy result (template not found in the theme datasource) throws 'Template not found.'
Source
Thrown at modules/cms/classes/editorextension/HasExtensionCrud.php:230
$content = str_replace('__SELF__', $componentAlias, $content);
return [
'content' => $content
];
}
/**
* loadTemplate returns an existing template of a given type
* @param string $documentType
* @param string $path
* @return mixed
*/
private function loadTemplate($documentType, $path)
{
$class = $this->resolveTypeClassName($documentType);
if (!($template = call_user_func([$class, 'load'], $this->getTheme(), $path))) {
throw new ApplicationException(trans('cms::lang.template.not_found'));
}
// Handle snippets
if ($documentType === EditorExtension::DOCUMENT_TYPE_PARTIAL) {
Snippet::processTemplateSettings($template);
}
/**
* @event cms.template.processSettingsAfterLoad
* Fires immediately after a CMS template (page|partial|layout|content|asset) has been loaded and provides an opportunity to interact with it.
*
* Example usage:
*
* Event::listen('cms.template.processSettingsAfterLoad', function ((\Cms\Classes\EditorExtension) $extension, (mixed) $templateObject) {
* // Make some modifications to the $template object
* });
*
* @deprecated remove second arg 'editor', context no longer usedView on GitHub (pinned to b608633a7e)
Solutions
- Refresh the editor / reopen the document list so metadata is rebuilt
- Verify the file exists under themes/<editTheme>/<typeDir>/<path> (pages/, partials/, layouts/, content/, assets/, meta/)
- Check Theme::getEditTheme() returns the theme you expect
- If the file was removed intentionally, close the stale editor tab
Defensive patterns
Strategy: validation
Validate before calling
$theme = \Cms\Classes\Theme::getEditTheme();
if (!\Cms\Classes\Page::load($theme, $path)) {
// template gone: refresh the list, close the tab, or show 'not found' with context
} Prevention
- Handle editor list refreshes after files change on disk
- Close editor tabs after deleting or renaming templates externally
- Keep the edit theme stable while editor sessions are open
When it happens
Trigger: The editor requests a template path that does not exist in the current edit theme — file deleted outside the editor, path taken from stale metadata, wrong edit theme active, or a path casing mismatch.
Common situations: Templates deleted on disk while the editor list is open; switching edit themes while an editor tab retains the old path; deploys where case-sensitivity differs; database-layer template records deleted under the editor.
Related errors
- cms::lang.theme.edit.not_set
- Cannot delete the active theme, try making another theme act
- cms::lang.partial.not_found_name
- cms::lang.content.not_found_name
- Component not found
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/7db65047b6e9c73e.
Report an issue: GitHub.