laravel/framework · error · RuntimeException

This database driver does not support the vector type.

Error message

This database driver does not support the vector type.

What it means

Base Grammar::typeVector() throws RuntimeException because the driver's grammar does not support the 'vector' column type. typeVector is dispatched by getType() when a Blueprint declares $table->vector($dimensions). Only a Postgres-aware grammar with pgvector support overrides it; other drivers do not ship vector storage.

Source

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

     *
     * @throws \RuntimeException
     */
    protected function typeComputed(Fluent $column)
    {
        throw new RuntimeException('This database driver does not support the computed type.');
    }

    /**
     * Create the column definition for a vector type.
     *
     * @param  \Illuminate\Support\Fluent  $column
     * @return string
     *
     * @throws \RuntimeException
     */
    protected function typeVector(Fluent $column)
    {
        throw new RuntimeException('This database driver does not support the vector type.');
    }

    /**
     * Create the column definition for a tsvector type.
     *
     * @param  \Illuminate\Support\Fluent  $column
     * @return string
     *
     * @throws \RuntimeException
     */
    protected function typeTsvector(Fluent $column)
    {
        throw new RuntimeException('This database driver does not support the tsvector type.');
    }

    /**
     * Create the column definition for a raw column type.
     *

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Switch to Postgres with the pgvector extension installed.
  2. Remove the vector() column on unsupported drivers, or store embeddings in a JSON/blob column instead.
  3. Conditionally create the column based on the driver/connection type.

Example fix

// before
Schema::create('embeddings', function (Blueprint $t) {
    $t->vector('embedding', 1536);
});

// after
if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
    Schema::create('embeddings', function (Blueprint $t) {
        $t->vector('embedding', 1536);
    });
} else {
    Schema::create('embeddings', function (Blueprint $t) {
        $t->json('embedding'); // fallback storage
    });
}
Defensive patterns

Strategy: validation

Validate before calling

if (! DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
    throw new \RuntimeException('Vector columns require Postgres + pgvector.');
}
Schema::create('embeddings', fn (Blueprint $t) => $t->vector('embedding', 1536));

Type guard

function driverSupportsVectorType(): bool
{
    return DB::connection() instanceof \Illuminate\Database\PostgresConnection;
}

Try / catch

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

Prevention

When it happens

Trigger: Declaring $table->vector('embedding', 1536) in a migration on MySQL, SQLite, or SQL Server, or any driver whose grammar does not override typeVector.

Common situations: Running AI/embedding migrations written for pgvector against a non-Postgres DB; CI defaulting to SQLite while the app uses vector columns.

Related errors


AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06). Data as JSON: /data/errors/4ce65fdbd831d673.json. Report an issue: GitHub.