laravel/framework · error · RuntimeException
This database driver does not support retrieving indexes.
Error message
This database driver does not support retrieving indexes.
What it means
Grammar::compileIndexes() throws RuntimeException on the base class. All four shipped grammars override it, so the throw fires only when the connection's SchemaGrammar is the unimplemented base. Builder::getIndexes() routes here.
Solutions
- Use a supported driver for index introspection.
- Override compileIndexes($schema, $table) in your custom grammar.
- Query the engine's index catalog directly (pg_indexes, SHOW INDEX, sys.indexes).
Example fix
// before
$idx = Schema::connection('custom')->getIndexes('users');
// after
$idx = DB::connection('custom')->select("SHOW INDEX FROM users"); Defensive patterns
Strategy: type-guard
Validate before calling
$grammar = Schema::getConnection()->getSchemaGrammar();
if (get_class($grammar) === \Illuminate\Database\Schema\Grammars\Grammar::class) {
throw new \DomainException('Connection uses the base Grammar; cannot list indexes.');
} Type guard
function supportsCompileIndexes(\Illuminate\Database\Schema\Grammars\Grammar $grammar): bool
{
return (new \ReflectionMethod($grammar, 'compileIndexes'))
->getDeclaringClass()->getName() !== \Illuminate\Database\Schema\Grammars\Grammar::class;
} Try / catch
try {
$indexes = Schema::getIndexes('users');
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'retrieving indexes')) {
$indexes = DB::select('SHOW INDEX FROM users');
} else {
throw $e;
}
} Prevention
- Bind a real grammar in custom drivers; do not ship the base Grammar.
- Gate index-inspection UI on the grammar class.
- Implement compileIndexes when authoring a new grammar.
When it happens
Trigger: Schema::getIndexes($table) on a connection whose SchemaGrammar is the base Grammar (custom driver).
Common situations: A driver bridge that returns the base Grammar; admin/inspection tooling that lists indexes across connections including an unsupported one.
Related errors
- The database driver in use does not support vector indexes.
- This database driver does not support dropping foreign keys.
- This database driver does not support fulltext index…
- This database driver does not support fulltext index…
- This database driver does not support modifying columns.
AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11).
Data as JSON: /api/errors/a0329285470fa719.
Report an issue: GitHub.
Appendix: source
Thrown at src/Illuminate/Database/Schema/Grammars/Grammar.php:154
* @throws \RuntimeException
*/
public function compileColumns($schema, $table)
{
throw new RuntimeException('This database driver does not support retrieving columns.');
}
/**
* Compile the query to determine the indexes.
*
* @param string|null $schema
* @param string $table
* @return string
*
* @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.View on GitHub (pinned to e0f6eb3518)