octobercms/october · error · SystemException
The component code viewBag is reserved. Please use another c
Error message
The component code viewBag is reserved. Please use another code for the component class %s.
What it means
Error "The component code viewBag is reserved. Please use another code for the component class %s." thrown in octobercms/october.
Source
Thrown at modules/cms/classes/ComponentManager.php:124
/**
* registerComponent registers a single component.
*/
public function registerComponent($className, $code = null, $owner = null)
{
if (!$this->classMap) {
$this->classMap = [];
}
if (!$this->codeMap) {
$this->codeMap = [];
}
if (!$code) {
$code = Str::getClassId($className);
}
if ($code === 'viewBag' && $className !== \Cms\Components\ViewBag::class) {
throw new SystemException(sprintf(
'The component code viewBag is reserved. Please use another code for the component class %s.',
$className
));
}
$className = Str::normalizeClassName($className);
$this->codeMap[$code] = $className;
$this->classMap[$className] = $code;
if ($owner !== null) {
if ($owner instanceof \System\Classes\PluginBase) {
$this->setComponentOwnerAsPlugin($code, $className, $owner);
}
else {
$this->setComponentOwnerAsProvider($code, $className, $owner);
}
}
}View on GitHub (pinned to b608633a7e)
When it happens
Trigger: Thrown at modules/cms/classes/ComponentManager.php:124 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/d4f81905135f0d17.
Report an issue: GitHub.