octobercms/october · error · CmsException
cms::lang.content.not_found_name
Error message
cms::lang.content.not_found_name
What it means
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.
Source
Thrown at modules/cms/classes/controller/HasRenderers.php:328
* });
*
* Or
*
* $controller->bindEvent('page.beforeRenderContent', function ((string) $contentName) {
* return Cms\Classes\Content::loadCached($theme, 'custom-content-name');
* });
*
*/
if ($event = $this->fireSystemEvent('cms.page.beforeRenderContent', [$name])) {
$content = $event;
}
else {
$content = $this->loadContentObject($name);
}
if ($content === false) {
if ($throwException) {
throw new CmsException(Lang::get('cms::lang.content.not_found_name', ['name'=>$name]));
}
else {
return false;
}
}
$fileContent = $content->parsedMarkup;
// Inject global view variables
$globalVars = ViewHelper::getGlobalVars();
if (!empty($globalVars)) {
$parameters = (array) $parameters + $globalVars;
}
// Parse basic template variables
if (!empty($parameters)) {
$fileContent = TextParser::parse($fileContent, $parameters);
}View on GitHub (pinned to b608633a7e)
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
Example fix
{# before #}
{% content 'terms' %}
{# after #}
{% content 'legal/terms' %} Defensive patterns
Strategy: validation
Validate before calling
$theme = \Cms\Classes\Theme::getActiveTheme();
if (!\Cms\Classes\Content::load($theme, 'legal/terms')) {
// content block missing: skip, fallback, or fail with context
} Try / catch
try { echo $this->renderContent('legal/terms'); } catch (\Cms\Classes\CmsException $e) { echo '<!-- content block missing -->'; } Prevention
- 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
When it happens
Trigger: {% content 'legal/terms' %} or $this->renderContent('legal/terms') when themes/<activeTheme>/content/legal/terms.htm does not exist.
Common situations: 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.
Related errors
- cms::lang.partial.not_found_name
- cms::lang.template.not_found
- cms::lang.layout.not_found_name
- cms::lang.theme.edit.not_set
- Cannot delete the active theme, try making another theme act
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/eed46bd603336f0f.
Report an issue: GitHub.