octobercms/october · error · SystemException
Dropdown menu item label is not provided for item type :type
Error message
Dropdown menu item label is not provided for item type :type
What it means
ItemDefinition is the PHP value object behind backend dropdown menus. Its constructor requires a non-empty label for every item type except TYPE_SEPARATOR (separators render a dividing line, not text). Instantiating any visible item without a label throws immediately at construction time.
Source
Thrown at modules/backend/vuecomponents/dropdownmenu/ItemDefinition.php:86
/**
* @var string|null key
*/
protected $key = null;
/**
* @var string|null group
*/
protected $group;
/**
* __construct
*/
public function __construct($type, ?string $label = null, ?string $command = null)
{
$this->type = $type;
if ($type != ItemDefinition::TYPE_SEPARATOR && !strlen($label)) {
throw new SystemException('Dropdown menu item label is not provided for item type '.$type);
}
if ($type != ItemDefinition::TYPE_SEPARATOR && !strlen($command)) {
throw new SystemException('Dropdown menu item command is not provided for item type '.$type);
}
$this->label = $label;
$this->command = $command;
}
/**
* Sets optional item key attribute
*/
public function setKey(string $value)
{
$this->key = $value;
}
View on GitHub (pinned to b608633a7e)
Solutions
- Pass a non-empty label as the second constructor argument: new ItemDefinition(ItemDefinition::TYPE_LINK, 'Open', 'openTab').
- Guard dynamic data: skip or default items whose label is null/empty before constructing.
- Use ItemDefinition::TYPE_SEPARATOR for visual dividers — the only type allowed to omit label and command.
Example fix
// before $item = new ItemDefinition(ItemDefinition::TYPE_LINK); // after $item = new ItemDefinition(ItemDefinition::TYPE_LINK, 'Open in new tab', 'openTab'); // separator is the only label-less type $sep = new ItemDefinition(ItemDefinition::TYPE_SEPARATOR);
Defensive patterns
Strategy: validation
Validate before calling
// Menu builder helper - validate labels coming from dynamic data
function makeItem($type, $label, $command)
{
if ($type !== ItemDefinition::TYPE_SEPARATOR && !strlen(trim((string) $label))) {
throw new InvalidArgumentException('Menu label missing for type ' . $type);
}
return new ItemDefinition($type, $label, $command);
} Prevention
- Default labels from localization with a visible fallback
- Skip data rows with empty labels instead of constructing items from them
- Remember the constructor order: type, label, command
When it happens
Trigger: new ItemDefinition(ItemDefinition::TYPE_LINK) with the second argument omitted (defaults to null); menu builders that read labels from data or localization and get null/empty for some rows.
Common situations: Menu items built from database rows where the label column is null; forgetting that separators are the only label-less type; passing label and command in the wrong order (type, label, command).
Related errors
- Dropdown menu item command is not provided for item type :ty
- Checkbox and radiobutton dropdown menu items cannot have ico
- getDependencies() must return an array: %s
- Vue component class not found: %s
- Vue component class must be a descendant of Backend\Classes\
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/2da2fb1839630b3c.
Report an issue: GitHub.