{"id":"1b32939806737446","repo":"drizzle-team/drizzle-orm","slug":"failed-to-run-the-query-staticquery-sql","errorCode":null,"errorMessage":"Failed to run the query '${staticQuery.sql}'","messagePattern":"Failed to run the query '(.+?)'","errorType":"exception","errorClass":"DrizzleError","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/sqlite-core/session.ts","lineNumber":271,"sourceCode":"\t\t\texecuteMethod,\n\t\t\tisResponseInArrayMode,\n\t\t\tcustomResultMapper,\n\t\t\tqueryMetadata,\n\t\t\tcacheConfig,\n\t\t);\n\t}\n\n\tabstract transaction<T>(\n\t\ttransaction: (tx: SQLiteTransaction<TResultKind, TRunResult, TFullSchema, TSchema>) => Result<TResultKind, T>,\n\t\tconfig?: SQLiteTransactionConfig,\n\t): Result<TResultKind, T>;\n\n\trun(query: SQL): Result<TResultKind, TRunResult> {\n\t\tconst staticQuery = this.dialect.sqlToQuery(query);\n\t\ttry {\n\t\t\treturn this.prepareOneTimeQuery(staticQuery, undefined, 'run', false).run() as Result<TResultKind, TRunResult>;\n\t\t} catch (err) {\n\t\t\tthrow new DrizzleError({ cause: err, message: `Failed to run the query '${staticQuery.sql}'` });\n\t\t}\n\t}\n\n\t/** @internal */\n\textractRawRunValueFromBatchResult(result: unknown) {\n\t\treturn result;\n\t}\n\n\tall<T = unknown>(query: SQL): Result<TResultKind, T[]> {\n\t\treturn this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, 'run', false).all() as Result<\n\t\t\tTResultKind,\n\t\t\tT[]\n\t\t>;\n\t}\n\n\t/** @internal */\n\textractRawAllValueFromBatchResult(_result: unknown): unknown {\n\t\tthrow new Error('Not implemented');","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/sqlite-core/session.ts#L253-L289","documentation":"Error \"Failed to run the query '${staticQuery.sql}'\" thrown in drizzle-team/drizzle-orm.","triggerScenarios":"A static (constant-folded) sqlite query fails when executed directly against the driver.","commonSituations":"DDL or PRAGMA-style static queries rejected by the underlying sqlite driver; schema drift between code and database.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}