flarum/framework · error · Exception

Configuration file does not exist.

Error message

Configuration file does not exist.

What it means

FileDataProvider loads installation answers from a configuration file. When the file is missing (or its data is falsy so the else branch is taken), its constructor throws Exception('Configuration file does not exist.'), aborting the unattended/headless install.

Solutions

  1. Verify the config file exists at the exact path passed to the installer (use an absolute path)
  2. Check file read permissions for the user running the installer
  3. Generate the configuration file first (e.g. by completing an interactive install) before running the headless install
  4. Wrap construction in try-catch and surface a clear message with the resolved path

Example fix

// before
$provider = new FileDataProvider('answers.json');
// after
$path = __DIR__.'/answers.json';
if (! is_file($path)) { throw new Exception("Config file missing: $path"); }
$provider = new FileDataProvider($path);
Defensive patterns

Strategy: try-catch

Validate before calling

$path = '/absolute/path/to/answers.json';
if (! is_file($path) || ! is_readable($path)) {
    throw new Exception("Installation config not found or unreadable: $path");
}

Try / catch

try {
    $provider = new FileDataProvider($path);
} catch (Exception $e) {
    $output->writeln("<error>{$e->getMessage()} Check: $path</error>");
    return Command::FAILURE;
}

Prevention

When it happens

Trigger: Running the install command with a path to a non-existent or unreadable configuration file; relative path resolved from the wrong working directory; file deleted between check and load.

Common situations: CI pipelines referencing an answers file that was never generated; wrong path passed to --file-style install; permissions preventing read so the file appears absent.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15). Data as JSON: /api/errors/c190003b9f3b25c9. Report an issue: GitHub.

Appendix: source

Thrown at framework/core/src/Install/Console/FileDataProvider.php:56

            // Try parsing JSON
            if (($json = json_decode($configurationFileContents, true)) !== null) {
                //Use JSON if Valid
                $configuration = $json;
            } else {
                //Else use YAML
                $configuration = Yaml::parse($configurationFileContents);
            }

            // Define configuration variables
            $this->debug = (bool) ($configuration['debug'] ?? false);
            $this->baseUrl = (string) ($configuration['baseUrl'] ?? 'http://flarum.localhost');
            $this->databaseConfiguration = (array) ($configuration['databaseConfiguration'] ?? []);
            $this->adminUser = (array) ($configuration['adminUser'] ?? []);
            $this->settings = (array) ($configuration['settings'] ?? []);
            $this->extensions = isset($configuration['extensions']) ? explode(',', (string) $configuration['extensions']) : null;
            $this->queue = (array) ($configuration['queue'] ?? ['driver' => 'sync']);
        } else {
            throw new Exception('Configuration file does not exist.');
        }
    }

    public function configure(Installation $installation): Installation
    {
        return $installation
            ->debugMode($this->debug)
            ->baseUrl(BaseUrl::fromString($this->baseUrl))
            ->databaseConfig($this->getDatabaseConfiguration())
            ->adminUser($this->getAdminUser())
            ->settings($this->settings)
            ->extensions($this->extensions)
            ->queueConfig($this->queue);
    }

    private function getDatabaseConfiguration(): DatabaseConfig
    {
        return new DatabaseConfig(

View on GitHub (pinned to 4b939f6853)