yiisoft/yii2 · error · Exception
The source path {$this->config['sourcePath']} is not a valid
Error message
The source path {$this->config['sourcePath']} is not a valid directory. What it means
Error "The source path {$this->config['sourcePath']} is not a valid directory." thrown in yiisoft/yii2.
Source
Thrown at framework/console/controllers/MessageController.php:988
if (!is_file($configFile)) {
throw new Exception("The configuration file does not exist: $configFile");
}
$configFileContent = require $configFile;
}
$this->config = array_merge(
$this->getOptionValues($this->action->id),
$configFileContent,
$this->getPassedOptionValues()
);
$this->config['sourcePath'] = Yii::getAlias($this->config['sourcePath']);
$this->config['messagePath'] = Yii::getAlias($this->config['messagePath']);
if (!isset($this->config['sourcePath'], $this->config['languages'])) {
throw new Exception('The configuration file must specify "sourcePath" and "languages".');
}
if (!is_dir($this->config['sourcePath'])) {
throw new Exception("The source path {$this->config['sourcePath']} is not a valid directory.");
}
if (empty($this->config['format']) || !in_array($this->config['format'], ['php', 'po', 'pot', 'db'])) {
throw new Exception('Format should be either "php", "po", "pot" or "db".');
}
if (in_array($this->config['format'], ['php', 'po', 'pot'])) {
if (!isset($this->config['messagePath'])) {
throw new Exception('The configuration file must specify "messagePath".');
}
if (!is_dir($this->config['messagePath'])) {
throw new Exception("The message path {$this->config['messagePath']} is not a valid directory.");
}
}
if (empty($this->config['languages'])) {
throw new Exception('Languages cannot be empty.');
}
if ($this->config['format'] === 'php' && $this->config['phpDocBlock'] === null) {
$this->config['phpDocBlock'] = <<<DOCBLOCKView on GitHub (pinned to 66f00d18a2)
When it happens
Trigger: Thrown at framework/console/controllers/MessageController.php:988 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/a03f87f83b10a88c.
Report an issue: GitHub.