yiisoft/yii2 · error · yii\console\Exception
Unknown option: --{name}
Error message
Unknown option: --{name} What it means
Error "Unknown option: --{name}" thrown in yiisoft/yii2.
Source
Thrown at framework/console/Controller.php:179
$this->$name = preg_split('/\s*,\s*(?![^()]*\))/', $value);
} elseif ($default !== null) {
settype($value, gettype($default));
$this->$name = $value;
} else {
$this->$name = $value;
}
$this->_passedOptions[] = $name;
unset($params[$name]);
if (isset($kebabName)) {
unset($params[$kebabName]);
}
} elseif (!is_int($name)) {
$message = Yii::t('yii', 'Unknown option: --{name}', ['name' => $name]);
if (!empty($options)) {
$message .= '. ' . Yii::t('yii', 'Options available: {options}', ['options' => '--' . implode(', --', $options)]);
}
throw new Exception($message);
}
}
}
if ($this->help) {
$route = $this->getUniqueId() . '/' . $id;
return Yii::$app->runAction('help', [$route]);
}
return parent::runAction($id, $params);
}
/**
* Binds the parameters to the action.
* This method is invoked by [[Action]] when it begins to run with the given parameters.
* This method will first bind the parameters with the [[options()|options]]
* available to the action. It then validates the given arguments.
* @param Action<static> $action the action to be bound with parameters
* @param array<array-key, mixed> $params the parameters to be bound to the actionView on GitHub (pinned to 66f00d18a2)
When it happens
Trigger: Thrown at framework/console/Controller.php:179 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17).
Data as JSON: /api/errors/076519f1955fc7b3.
Report an issue: GitHub.