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
Base Grammar::compileVectorIndex() throws RuntimeException because the driver does not support vector indexes (pgvector-style). Only a Postgres-aware grammar with vector support overrides it. Thrown when a Blueprint vector index command is compiled on an unsupported driver.
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 bd6b5437e6)
Solutions
- Switch the connection to Postgres with the pgvector extension installed.
- Remove the vector index command from migrations running on unsupported drivers.
- Conditionally apply vector index logic only when DB::connection() is PostgresConnection.
Example fix
// before
Schema::create('docs', function (Blueprint $t) {
$t->vectorIndex('embedding');
});
// after
if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
Schema::create('docs', function (Blueprint $t) {
$t->vectorIndex('embedding');
});
} Defensive patterns
Strategy: validation
Validate before calling
if (! DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
throw new \RuntimeException('Vector indexes require Postgres + pgvector.');
}
Schema::create('docs', fn (Blueprint $t) => $t->vectorIndex('embedding')); Type guard
function driverSupportsVectorIndex(): bool
{
return DB::connection() instanceof \Illuminate\Database\PostgresConnection;
} Try / catch
try {
Schema::create('docs', fn (Blueprint $t) => $t->vectorIndex('embedding'));
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'vector indexes')) {
// skip vector index on non-Postgres
} else {
throw $e;
}
} Prevention
- Reserve vectorIndex()/vector() for Postgres with pgvector.
- Keep CI driver aligned with production for AI/embedding migrations.
- Guard vector migrations with instanceof PostgresConnection.
When it happens
Trigger: Calling $table->vectorIndex() / $table->vector() with an index, or any blueprint command that produces a vector-index Fluent whose compiler dispatches to Grammar::compileVectorIndex, on MySQL/SQLite/SQL Server or an incomplete custom grammar.
Common situations: Running a migration written for pgvector against MySQL/SQLite; CI defaulting to SQLite while migrations use vector columns/indexes.
Related errors
- This database driver does not support the vector type.
- Extensions are only supported by Postgres.
- This database driver does not support retrieving user-define
- This database driver does not support retrieving indexes.
- This database driver does not support fulltext index creatio
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/804efb5a65e6cd63.json.
Report an issue: GitHub.