{"record":{"id":"7db65047b6e9c73e","repo":"octobercms/october","slug":"cms-lang-template-not-found","errorCode":null,"errorMessage":"cms::lang.template.not_found","messagePattern":"cms::lang\\.template\\.not_found","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/editorextension/HasExtensionCrud.php","lineNumber":230,"sourceCode":"        $content = str_replace('__SELF__', $componentAlias, $content);\n\n        return [\n            'content' => $content\n        ];\n    }\n\n    /**\n     * loadTemplate returns an existing template of a given type\n     * @param string $documentType\n     * @param string $path\n     * @return mixed\n     */\n    private function loadTemplate($documentType, $path)\n    {\n        $class = $this->resolveTypeClassName($documentType);\n\n        if (!($template = call_user_func([$class, 'load'], $this->getTheme(), $path))) {\n            throw new ApplicationException(trans('cms::lang.template.not_found'));\n        }\n\n        // Handle snippets\n        if ($documentType === EditorExtension::DOCUMENT_TYPE_PARTIAL) {\n            Snippet::processTemplateSettings($template);\n        }\n\n        /**\n         * @event cms.template.processSettingsAfterLoad\n         * Fires immediately after a CMS template (page|partial|layout|content|asset) has been loaded and provides an opportunity to interact with it.\n         *\n         * Example usage:\n         *\n         *     Event::listen('cms.template.processSettingsAfterLoad', function ((\\Cms\\Classes\\EditorExtension) $extension, (mixed) $templateObject) {\n         *         // Make some modifications to the $template object\n         *     });\n         *\n         * @deprecated remove second arg 'editor', context no longer used","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/editorextension/HasExtensionCrud.php#L212-L248","documentation":"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.'","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$theme = \\Cms\\Classes\\Theme::getEditTheme();\nif (!\\Cms\\Classes\\Page::load($theme, $path)) {\n    // template gone: refresh the list, close the tab, or show 'not found' with context\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["editor","template","cms","theme","backend"],"backgroundTag":"template-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}