{"record":{"id":"eb9309c4df4cfa4d","repo":"octobercms/october","slug":"cms-lang-component-not-found","errorCode":null,"errorMessage":"cms::lang.component.not_found","messagePattern":"cms::lang\\.component\\.not_found","errorType":"exception","errorClass":"CmsException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/controller/HasComponentHelpers.php","lineNumber":59,"sourceCode":"     * @param array  $properties\n     * @param bool   $addToLayout\n     * @return ComponentBase|null\n     */\n    public function addComponent($name, $alias, $properties = [], $addToLayout = false)\n    {\n        $manager = ComponentManager::instance();\n\n        if ($addToLayout) {\n            $componentObj = $manager->makeComponent($name, $this->layoutObj, $properties);\n        }\n        else {\n            $componentObj = $manager->makeComponent($name, $this->pageObj, $properties);\n        }\n\n        if (!$componentObj) {\n            $strictMode = Config::get('cms.strict_components', false);\n            if ($strictMode) {\n                throw new CmsException(Lang::get('cms::lang.component.not_found', ['name' => $name]));\n            }\n            else {\n                return $this->vars[$alias] = null;\n            }\n        }\n\n        $componentObj->alias = $alias;\n\n        if ($addToLayout) {\n            $this->layout->components[$alias] = $componentObj;\n        }\n        else {\n            $this->page->components[$alias] = $componentObj;\n        }\n\n        $this->vars[$alias] = $componentObj->makePrimaryAccessor();\n\n        $this->parseRouteParamsOnComponent($componentObj, $this->router->getParameters());","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/controller/HasComponentHelpers.php#L41-L77","documentation":"When a component declared on a page or layout cannot be created (ComponentManager::makeComponent returns null because the component is unregistered, its plugin is missing or disabled), the controller either sets the variable to null silently (default) or, with cms.strict_components enabled in config/cms.php, throws this CmsException naming the component.","triggerScenarios":"A page or layout 'components' declaration (or addComponent() call) referencing a component ComponentManager cannot resolve, e.g. 'MyPlugin::Items' from an uninstalled plugin, while 'cms.strict_components' => true.","commonSituations":"Plugin disabled or uninstalled while pages still reference its components; typo in the component name or plugin prefix; enabling strict_components (newer Winter enables it in dev) exposing previously silent breakage; environments drifting between strict and lenient configs.","solutions":["Register the component in the plugin's registerComponents() and confirm the plugin is installed and enabled","Fix the reference: correct plugin namespace and component name, correct casing","Remove the stale component entry from the page/layout","If you must render anyway, set 'strict_components' => false in config/cms.php to restore lenient behaviour"],"exampleFix":"// before: page references a component from a disabled plugin\n[myPlugin someWidget]\n==\n\n// after: remove the stale reference (or reinstall/re-enable the plugin first)\n==","handlingStrategy":"validation","validationCode":"use \\Cms\\Classes\\ComponentManager;\n$manager = ComponentManager::instance();\nforeach ($declaredComponentNames as $name) {\n    if (!$manager->hasComponent($name)) {\n        // skip, log, or fail before the page renders\n    }\n}","typeGuard":null,"tryCatchPattern":"try { $this->addComponent('X', 'alias', $props); } catch (\\Cms\\Classes\\CmsException $e) { // strict mode: component unresolved, degrade gracefully }","preventionTips":["Keep strict_components enabled in development so missing components fail loudly there","Run a sweep for stale component references after uninstalling plugins","Register aliases in registerComponents() for renamed components"],"tags":["component","cms","strict-mode","plugin","configuration"],"backgroundTag":"component-not-registered","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}