drizzle-team/drizzle-orm · error · DrizzleError
Failed to run the query '${staticQuery.sql}'
Error message
Failed to run the query '${staticQuery.sql}' What it means
Error "Failed to run the query '${staticQuery.sql}'" thrown in drizzle-team/drizzle-orm.
Source
Thrown at drizzle-orm/src/sqlite-core/session.ts:271
executeMethod,
isResponseInArrayMode,
customResultMapper,
queryMetadata,
cacheConfig,
);
}
abstract transaction<T>(
transaction: (tx: SQLiteTransaction<TResultKind, TRunResult, TFullSchema, TSchema>) => Result<TResultKind, T>,
config?: SQLiteTransactionConfig,
): Result<TResultKind, T>;
run(query: SQL): Result<TResultKind, TRunResult> {
const staticQuery = this.dialect.sqlToQuery(query);
try {
return this.prepareOneTimeQuery(staticQuery, undefined, 'run', false).run() as Result<TResultKind, TRunResult>;
} catch (err) {
throw new DrizzleError({ cause: err, message: `Failed to run the query '${staticQuery.sql}'` });
}
}
/** @internal */
extractRawRunValueFromBatchResult(result: unknown) {
return result;
}
all<T = unknown>(query: SQL): Result<TResultKind, T[]> {
return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, 'run', false).all() as Result<
TResultKind,
T[]
>;
}
/** @internal */
extractRawAllValueFromBatchResult(_result: unknown): unknown {
throw new Error('Not implemented');View on GitHub (pinned to b7862528fd)
Solutions
- Check that the SQL of the prepared/static query is valid for SQLite and that all bound parameters are provided.
- Verify the underlying database connection is open before running the query.
When it happens
Trigger: A static (constant-folded) sqlite query fails when executed directly against the driver.
Common situations: DDL or PRAGMA-style static queries rejected by the underlying sqlite driver; schema drift between code and database.
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/1b32939806737446.json.
Report an issue: GitHub.