{"record":{"id":"d4f81905135f0d17","repo":"octobercms/october","slug":"the-component-code-viewbag-is-reserved-please-use","errorCode":null,"errorMessage":"The component code viewBag is reserved. Please use another code for the component class %s.","messagePattern":"The component code viewBag is reserved\\. Please use another code for the component class (.+?)\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/ComponentManager.php","lineNumber":124,"sourceCode":"    /**\n     * registerComponent registers a single component.\n     */\n    public function registerComponent($className, $code = null, $owner = null)\n    {\n        if (!$this->classMap) {\n            $this->classMap = [];\n        }\n\n        if (!$this->codeMap) {\n            $this->codeMap = [];\n        }\n\n        if (!$code) {\n            $code = Str::getClassId($className);\n        }\n\n        if ($code === 'viewBag' && $className !== \\Cms\\Components\\ViewBag::class) {\n            throw new SystemException(sprintf(\n                'The component code viewBag is reserved. Please use another code for the component class %s.',\n                $className\n            ));\n        }\n\n        $className = Str::normalizeClassName($className);\n        $this->codeMap[$code] = $className;\n        $this->classMap[$className] = $code;\n\n        if ($owner !== null) {\n            if ($owner instanceof \\System\\Classes\\PluginBase) {\n                $this->setComponentOwnerAsPlugin($code, $className, $owner);\n            }\n            else {\n                $this->setComponentOwnerAsProvider($code, $className, $owner);\n            }\n        }\n    }","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/ComponentManager.php#L106-L142","documentation":"Error \"The component code viewBag is reserved. Please use another code for the component class %s.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/cms/classes/ComponentManager.php:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}