drizzle-team/drizzle-orm · error · DrizzleQueryError

Failed query: ${query} params: ${params}

Error message

Failed query: ${query}
params: ${params}

What it means

Error "Failed query: ${query} params: ${params}" thrown in drizzle-team/drizzle-orm.

Source

Thrown at drizzle-orm/src/gel-core/session.ts:51

		if (cache && cache.strategy() === 'all' && cacheConfig === undefined) {
			this.cacheConfig = { enable: true, autoInvalidate: true };
		}
		if (!this.cacheConfig?.enable) {
			this.cacheConfig = undefined;
		}
	}

	/** @internal */
	protected async queryWithCache<T>(
		queryString: string,
		params: any[],
		query: () => Promise<T>,
	): Promise<T> {
		if (this.cache === undefined || is(this.cache, NoopCache) || this.queryMetadata === undefined) {
			try {
				return await query();
			} catch (e) {
				throw new DrizzleQueryError(queryString, params, e as Error);
			}
		}

		// don't do any mutations, if globally is false
		if (this.cacheConfig && !this.cacheConfig.enable) {
			try {
				return await query();
			} catch (e) {
				throw new DrizzleQueryError(queryString, params, e as Error);
			}
		}

		// For mutate queries, we should query the database, wait for a response, and then perform invalidation
		if (
			(
				this.queryMetadata.type === 'insert' || this.queryMetadata.type === 'update'
				|| this.queryMetadata.type === 'delete'
			) && this.queryMetadata.tables.length > 0

View on GitHub (pinned to b7862528fd)

Solutions

  1. Inspect the logged query and params to find the underlying database error (syntax, constraint violation, connection issue).
  2. Validate parameter types match the column types expected by the query.
  3. Wrap the call in try/catch and surface the original driver error cause for details.

When it happens

Trigger: Any Gel query execution that the database rejects; Drizzle wraps the driver error with the failing query and params.

Common situations: Syntax errors, constraint violations, missing tables/columns, or type mismatches surfaced through the Gel session.


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/e4417dbe29c2fa11.json. Report an issue: GitHub.