yiisoft/yii2 · error · Exception

The configuration file does not exist: $configFile

Error message

The configuration file does not exist: $configFile

What it means

Error "The configuration file does not exist: $configFile" thrown in yiisoft/yii2.

Source

Thrown at framework/console/controllers/MessageController.php:971

            if (!in_array($category, $existingCategories, true)) {
                unlink($messageFile);
            }
        }
    }

    /**
     * @param string $configFile
     * @throws Exception If configuration file does not exists.
     * @since 2.0.13
     */
    protected function initConfig($configFile)
    {
        $configFileContent = [];
        if ($configFile !== null) {
            $configFile = Yii::getAlias($configFile);
            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.");
        }

View on GitHub (pinned to 66f00d18a2)

When it happens

Trigger: Thrown at framework/console/controllers/MessageController.php:971 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/4c0ba0732df80610. Report an issue: GitHub.