laravel/framework · error · RuntimeException

The database driver in use does not support vector indexes.

Error message

The database driver in use does not support vector indexes.

What it means

Grammar::compileVectorIndex() throws RuntimeException on the base; only PostgresGrammar and MariaDbGrammar override it (Maria via its own override, MySQL/Maria vector support; SQLite and SQL Server do not). The throw fires from Blueprint when a vectorIndex() command is built against a grammar that cannot compile it.

Solutions

  1. Run vector-index migrations only on Postgres (preferred) or MariaDB.
  2. In tests, skip or stub the vector-index migration when the connection is SQLite.
  3. If you must store vectors on an unsupported engine, drop vectorIndex() and manage indexing in application code or use a dedicated vector store.

Example fix

// before - runs on SQLite in tests and throws
Schema::create('documents', function (Blueprint $t) {
    $t->vector('embedding', 1536)->vectorIndex();
});

// after - gate by driver
Schema::create('documents', function (Blueprint $t) {
    $col = $t->vector('embedding', 1536);
    if (in_array(config('database.default'), ['pgsql', 'mariadb'])) {
        $col->vectorIndex();
    }
});
Defensive patterns

Strategy: validation

Validate before calling

use Illuminate\Database\PostgresConnection;
use Illuminate\Database\MariaDbConnection;

$conn = Schema::getConnection();
$supportsVectorIndex = $conn instanceof PostgresConnection
    || $conn instanceof MariaDbConnection;

if (! $supportsVectorIndex) {
    throw new \DomainException('Vector indexes require Postgres or MariaDB.');
}

Type guard

use Illuminate\Database\PostgresConnection;
use Illuminate\Database\MariaDbConnection;

function supportsVectorIndex(\Illuminate\Database\Connection $connection): bool
{
    return $connection instanceof PostgresConnection
        || $connection instanceof MariaDbConnection;
}

Try / catch

try {
    Schema::create('docs', fn ($t) => $t->vector('embedding', 1536)->vectorIndex());
} catch (\RuntimeException $e) {
    if (str_contains($e->getMessage(), 'vector indexes')) {
        Schema::create('docs', fn ($t) => $t->vector('embedding', 1536));
    } else {
        throw $e;
    }
}

Prevention

When it happens

Trigger: Defining $table->vector('embedding', 1536)->vectorIndex() (or any command that issues a vector index key) in a migration running on plain MySQL, SQLite, or SQL Server.

Common situations: Running migrations originally written for Postgres+pgvector on a SQLite test database; shipping a vector search feature on an engine that lacks vector index support; Maria vs plain MySQL mismatch (MariaDB supports, plain MySQL does not).

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/804efb5a65e6cd63. Report an issue: GitHub.

Appendix: source

Thrown at src/Illuminate/Database/Schema/Grammars/Grammar.php:168

     * @throws \RuntimeException
     */
    public function compileIndexes($schema, $table)
    {
        throw new RuntimeException('This database driver does not support retrieving indexes.');
    }

    /**
     * Compile a vector index key command.
     *
     * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
     * @param  \Illuminate\Support\Fluent  $command
     * @return void
     *
     * @throws \RuntimeException
     */
    public function compileVectorIndex(Blueprint $blueprint, Fluent $command)
    {
        throw new RuntimeException('The database driver in use does not support vector indexes.');
    }

    /**
     * Compile the query to determine the foreign keys.
     *
     * @param  string|null  $schema
     * @param  string  $table
     * @return string
     *
     * @throws \RuntimeException
     */
    public function compileForeignKeys($schema, $table)
    {
        throw new RuntimeException('This database driver does not support retrieving foreign keys.');
    }

    /**
     * Compile a rename column command.

View on GitHub (pinned to e0f6eb3518)