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

  1. Create the content file under themes/<activeTheme>/content/ at the exact referenced path (.htm default extension)
  2. Fix the reference path in the template
  3. Verify the active theme is the one containing the content block
  4. 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

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


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/eed46bd603336f0f. Report an issue: GitHub.