octobercms/october · error · ApplicationException

cms::lang.component.not_found

Error message

cms::lang.component.not_found

What it means

While expanding a CMS component in the editor, findComponentClassByAlias() failed to map the supplied alias to a component class using the request's documentData; the editor throws 'The component :name is not found.' It means the alias is not present in the current document's component definitions, distinct from the component class being unregistered.

Source

Thrown at modules/cms/classes/editorextension/HasExtensionCrud.php:201

         *         \Log::info("A $type has been deleted");
         *     });
         */
        $this->fireSystemEvent('cms.template.delete', [$documentType]);
    }

    /**
     * command_onExpandCmsComponent
     */
    protected function command_onExpandCmsComponent()
    {
        if (!$componentAlias = post('componentAlias')) {
            throw new ApplicationException(trans('cms::lang.component.no_records'));
        }

        $documentData = $this->getRequestDocumentData();
        $componentClass = $this->findComponentClassByAlias($componentAlias, $documentData);
        if (!$componentClass) {
            throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $componentAlias]));
        }

        $manager = ComponentManager::instance();
        $componentObj = $manager->makeComponent($componentClass);
        $partial = ComponentPartial::load($componentObj, 'default');
        if (!$partial) {
            throw new ApplicationException(__('Component does use a default partial'));
        }

        $content = $partial->getContent();
        $content = str_replace('__SELF__', $componentAlias, $content);

        return [
            'content' => $content
        ];
    }

    /**

View on GitHub (pinned to b608633a7e)

Solutions

  1. Save/reload the document in the editor so documentData includes the component and the alias matches
  2. Verify the alias spelling — it must equal the alias defined in the template's components section
  3. Confirm the component's plugin is installed so the alias can resolve to a class
Defensive patterns

Strategy: validation

Validate before calling

$aliases = array_keys($documentData['components'] ?? []);
if (!in_array($componentAlias, $aliases, true)) {
    // alias not part of this document: refresh document data or bail out
}

Type guard

function aliasInDocument(alias, documentData) {
  return Object.prototype.hasOwnProperty.call(documentData?.components ?? {}, alias);
}

Prevention

When it happens

Trigger: onExpandCmsComponent receives componentAlias 'foo' that is not declared in the documentData sent with the request — the component was removed from the template but a stale editor panel still references it, or the payload reflects an older revision of the document.

Common situations: Unsaved or rolled-back documents; two editor tabs editing the same template; custom code passing an alias that was never attached to the document.

Related errors


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