flarum/framework · error · ValidationFailed

Currently, only MySQL, MariaDB, SQLite and PostgreSQL are…

Error message

Currently, only MySQL, MariaDB, SQLite and PostgreSQL are supported.

What it means

DatabaseConfig::validate() restricts drivers to mysql, mariadb, sqlite and pgsql. Any other driver value throws ValidationFailed listing the supported engines, because the installer only ships drivers for those databases.

Solutions

  1. Use one of the supported drivers: mysql, mariadb, sqlite, pgsql
  2. Fix the driver spelling (e.g. 'postgres' → 'pgsql')
  3. Migrate the database to a supported engine before installing
  4. Add a third-party storage/driver extension if one exists for your engine

Example fix

// before
$configuration = ['driver' => 'postgres', ...];
// after
$configuration = ['driver' => 'pgsql', ...];
Defensive patterns

Strategy: validation

Validate before calling

$allowed = ['mysql', 'mariadb', 'sqlite', 'pgsql'];
if (! in_array($configuration['driver'] ?? '', $allowed, true)) {
    throw new ValidationFailed('Driver must be one of: '.implode(', ', $allowed));
}

Try / catch

try {
    $dbConfig = new DatabaseConfig($configuration);
} catch (ValidationFailed $e) {
    $output->writeln("<error>{$e->getMessage()}</error>");
    return Command::FAILURE;
}

Prevention

When it happens

Trigger: Constructing DatabaseConfig with driver 'sqlsrv', 'oracle', or any value outside the four allowed; typos like 'postgres' or 'mysql2'.

Common situations: Users on SQL Server or other unsupported engines attempting installation; typo'd driver names ('postgres' instead of 'pgsql').

Related errors


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

Appendix: source

Thrown at framework/core/src/Install/DatabaseConfig.php:48

    public function toArray(): array
    {
        return array_merge([
            'driver' => $this->driver,
            'database' => $this->database,
            'prefix' => $this->prefix,
            'prefix_indexes' => true
        ], $this->driverOptions());
    }

    private function validate(): void
    {
        if (empty($this->driver)) {
            throw new ValidationFailed('Please specify a database driver.');
        }

        if (! in_array($this->driver, ['mysql', 'mariadb', 'sqlite', 'pgsql'])) {
            throw new ValidationFailed('Currently, only MySQL, MariaDB, SQLite and PostgreSQL are supported.');
        }

        if (empty($this->host) && in_array($this->driver, ['mysql', 'mariadb', 'pgsql'])) {
            throw new ValidationFailed('Please specify the hostname of your database server.');
        }

        if (($this->port < 1 || $this->port > 65535) && in_array($this->driver, ['mysql', 'mariadb', 'pgsql'])) {
            throw new ValidationFailed('Please provide a valid port number between 1 and 65535.');
        }

        if (empty($this->database)) {
            throw new ValidationFailed('Please specify the database name.');
        }

        if (empty($this->schema) && $this->driver == 'pgsql') {
            throw new ValidationFailed('Please specify the schema name.');
        }

View on GitHub (pinned to 4b939f6853)