octobercms/october · error · SystemException
Dropdown menu item command is not provided for item type :ty
Error message
Dropdown menu item command is not provided for item type :type
What it means
The same ItemDefinition constructor also requires a non-empty command for every non-separator item, because a menu item signals selection by emitting that command string to the UI. Without a command the item would be unclickable, so construction fails fast rather than producing a dead menu entry.
Source
Thrown at modules/backend/vuecomponents/dropdownmenu/ItemDefinition.php:90
/**
* @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;
}
/**
* setLinkHref
*/
public function setLinkHref(string $value)View on GitHub (pinned to b608633a7e)
Solutions
- Provide the command as the third argument: new ItemDefinition(ItemDefinition::TYPE_BUTTON, 'Save', 'save:all').
- Default missing dynamic commands, e.g. $command = $data['command'] ?? 'noop';
- Confirm separator items actually use ItemDefinition::TYPE_SEPARATOR if they are meant to omit the command.
Example fix
// before $item = new ItemDefinition(ItemDefinition::TYPE_LINK, 'Open list'); // after $item = new ItemDefinition(ItemDefinition::TYPE_LINK, 'Open list', 'open:list');
Defensive patterns
Strategy: validation
Validate before calling
// Menu builder helper - validate commands coming from dynamic data
function makeItem($type, $label, $command)
{
if ($type !== ItemDefinition::TYPE_SEPARATOR && !strlen(trim((string) $command))) {
throw new InvalidArgumentException('Menu command missing for type ' . $type);
}
return new ItemDefinition($type, $label, $command);
} Prevention
- Default missing dynamic commands, e.g. $data['command'] ?? 'noop'
- Use TYPE_SEPARATOR for dividers - the only command-less type
- Keep handler names and the commands that emit them in one place
When it happens
Trigger: new ItemDefinition(ItemDefinition::TYPE_LINK, 'Open') with the third argument omitted; command strings built dynamically that end up as '' or null; swapping the label and command arguments.
Common situations: Renaming a handler and forgetting the menu item that emits it, leaving an empty string; building items from config arrays that lack a 'command' key; intending a separator but mistyping the type constant so the item is a regular type.
Related errors
- Dropdown menu item label is not provided for item type :type
- 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/6c72190ce4a5292b.
Report an issue: GitHub.