octobercms/october · error · ApplicationException
Please select a widget to add.
Error message
Please select a widget to add.
What it means
Input guard in the onAddWidget AJAX handler of the dashboard report container: after the permission check passes, it reads the 'className' POST field and throws when it is empty. This means the 'add widget' request arrived without a selected widget class — a UI bug where the dropdown submitted nothing, or a hand-crafted request.
Solutions
- Ensure the add-widget popup always posts a non-empty className (preselect a default widget in the dropdown)
- Validate on the client that a widget is selected before submitting the request
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/backend/widgets/ReportContainer.php:250 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/a9f267ac9613b56b.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/widgets/ReportContainer.php:250
$this->vars['widgets'] = DashManager::instance()->listReportWidgets();
return $this->makePartial('new_widget_popup');
}
/**
* onAddWidget
*/
public function onAddWidget()
{
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']View on GitHub (pinned to b608633a7e)