{"record":{"id":"eed46bd603336f0f","repo":"octobercms/october","slug":"cms-lang-content-not-found-name","errorCode":null,"errorMessage":"cms::lang.content.not_found_name","messagePattern":"cms::lang\\.content\\.not_found_name","errorType":"exception","errorClass":"CmsException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/controller/HasRenderers.php","lineNumber":328,"sourceCode":"         *     });\n         *\n         * Or\n         *\n         *     $controller->bindEvent('page.beforeRenderContent', function ((string) $contentName) {\n         *         return Cms\\Classes\\Content::loadCached($theme, 'custom-content-name');\n         *     });\n         *\n         */\n        if ($event = $this->fireSystemEvent('cms.page.beforeRenderContent', [$name])) {\n            $content = $event;\n        }\n        else {\n            $content = $this->loadContentObject($name);\n        }\n\n        if ($content === false) {\n            if ($throwException) {\n                throw new CmsException(Lang::get('cms::lang.content.not_found_name', ['name'=>$name]));\n            }\n            else {\n                return false;\n            }\n        }\n\n        $fileContent = $content->parsedMarkup;\n\n        // Inject global view variables\n        $globalVars = ViewHelper::getGlobalVars();\n        if (!empty($globalVars)) {\n            $parameters = (array) $parameters + $globalVars;\n        }\n\n        // Parse basic template variables\n        if (!empty($parameters)) {\n            $fileContent = TextParser::parse($fileContent, $parameters);\n        }","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/controller/HasRenderers.php#L310-L346","documentation":"renderContent() (backing the {% content %} tag) could not load the named content block: no cms.page.beforeRenderContent event supplied it and loadContentObject() failed to find it in the theme. With $throwException true (the default for the tag) it throws; otherwise it returns false.","triggerScenarios":"{% content 'legal/terms' %} or $this->renderContent('legal/terms') when themes/<activeTheme>/content/legal/terms.htm does not exist.","commonSituations":"Renaming content blocks without updating templates; splitting a site into themes where a block was not copied; localized content variants missing; casing differences surfacing on Linux deployment.","solutions":["Create the content file under themes/<activeTheme>/content/ at the exact referenced path (.htm default extension)","Fix the reference path in the template","Verify the active theme is the one containing the content block","For optional blocks, call renderContent($name, [], false) and branch on the false return"],"exampleFix":"{# before #}\n{% content 'terms' %}\n\n{# after #}\n{% content 'legal/terms' %}","handlingStrategy":"validation","validationCode":"$theme = \\Cms\\Classes\\Theme::getActiveTheme();\nif (!\\Cms\\Classes\\Content::load($theme, 'legal/terms')) {\n    // content block missing: skip, fallback, or fail with context\n}","typeGuard":null,"tryCatchPattern":"try { echo $this->renderContent('legal/terms'); } catch (\\Cms\\Classes\\CmsException $e) { echo '<!-- content block missing -->'; }","preventionTips":["Keep content-block paths in one place (partials/settings) instead of scattering literals","When cloning themes, copy the content/ directory along with partials/","Prefer renderContent($name, [], false) plus a false check for optional blocks"],"tags":["content","cms","template","theme","twig"],"backgroundTag":"template-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}