octobercms/october · error · ApplicationException
The selected class is not a report widget.
Error message
The selected class is not a report widget.
What it means
Type guard in onAddWidget: the posted class exists and was instantiated, but the resulting object is not an instance of Backend\Classes\ReportWidgetBase. The dashboard can only host report widgets, so any other class (a form widget, controller, or arbitrary class) is rejected before being added.
Solutions
- Extend Backend\Classes\ReportWidgetBase in the widget class being added
- Select a genuine report widget from the dashboard's available widget list instead of an arbitrary class
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at modules/backend/widgets/ReportContainer.php:259 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/7d3a398fde9e3e84.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/widgets/ReportContainer.php:259
{
if (!$this->showAddRemove) {
throw new ForbiddenException;
}
$className = trim(Request::input('className'));
$size = trim(Request::input('size'));
if (!$className) {
throw new ApplicationException("Please select a widget to add.");
}
if (!class_exists($className)) {
throw new ApplicationException("The selected class doesn't exist.");
}
$widget = new $className($this->controller);
if (!($widget instanceof \Backend\Classes\ReportWidgetBase)) {
throw new ApplicationException("The selected class is not a report widget.");
}
$widgetInfo = $this->addWidget($widget, $size);
return [
'@#'.$this->getId('container-list') => $this->makePartial('widget', [
'widget' => $widget,
'widgetAlias' => $widgetInfo['alias'],
'sortOrder' => $widgetInfo['sortOrder']
])
];
}
/**
* onSetWidgetOrders
*/
public function onSetWidgetOrders()
{View on GitHub (pinned to b608633a7e)