flarum/framework · error · RuntimeException

Unsupported database driver

Error message

Unsupported database driver: {driverName}

What it means

Flarum's FulltextFilter dispatches the search filter to a driver-specific implementation via a match expression over the connection driver name; any driver other than mysql/mariadb/pgsql/sqlite hits the default arm and throws a RuntimeException. The library only ships fulltext search backends for the built-in drivers. The offending driver name is included in the message.

Solutions

  1. Use one of the supported drivers (mysql, mariadb, pgsql, sqlite) for the forum database
  2. Remove or disable the third-party driver extension that overrides the default connection
  3. Implement a matching fulltext filter path in the custom driver's integration, or contribute driver support upstream

Example fix

// before (config.php)
'driver' => 'sqlsrv', // unsupported fulltext search
// after
'driver' => 'mysql',
Defensive patterns

Strategy: try-catch

Validate before calling

$driver = $state->getQuery()->getConnection()->getDriverName();
if (!in_array($driver, ['mysql','mariadb','pgsql','sqlite'], true)) { /* disable search filter or fall back */ }

Try / catch

try { $filter->filter($state, $value); } catch (RuntimeException $e) { Log::warning($e->getMessage()); fall back to LIKE-based search; }

Prevention

When it happens

Trigger: Performing a search (filter[q]) on a connection whose getDriverName() returns something else — e.g. a custom third-party database driver (sqlsrv, oracle, mongodb bridge) registered on the Flarum forum connection.

Common situations: Installing a community database-driver extension and then searching; tests running against an unsupported driver; misconfiguring config.php with an unsupported driver string that some connector accepts.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.


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

Appendix: source

Thrown at framework/core/src/Post/Filter/FulltextFilter.php:41

{
    public function __construct(
        protected SettingsRepositoryInterface $settings
    ) {
    }

    public function search(SearchState $state, string $value): void
    {
        if ($this->settings->get('search_cjk_mode')) {
            $this->like($state, $value);

            return;
        }

        match ($state->getQuery()->getConnection()->getDriverName()) {
            'mysql', 'mariadb' => $this->mysql($state, $value),
            'pgsql' => $this->pgsql($state, $value),
            'sqlite' => $this->sqlite($state, $value),
            default => throw new RuntimeException('Unsupported database driver: '.$state->getQuery()->getConnection()->getDriverName()),
        };
    }

    protected function sqlite(DatabaseSearchState $state, string $value): void
    {
        $this->like($state, $value);
    }

    protected function like(DatabaseSearchState $state, string $value): void
    {
        $state->getQuery()->where('content', 'like', "%$value%");
    }

    protected function mysql(DatabaseSearchState $state, string $value): void
    {
        $query = $state->getQuery();

        // Replace all non-word characters with spaces.

View on GitHub (pinned to 4b939f6853)