cube-js/cube · error · Error
Unable to detect SQL escaping rules for db type "${this.conf
Error message
Unable to detect SQL escaping rules for db type "${this.config.dbType}" What it means
escapeDialect() resolves the SQL string-escaping rules from a per-db-type description table (JDBCDriver.dbTypeDescription). It throws when the configured dbType has no registered description containing an escapeDialect — i.e. the JDBC driver was configured for a database flavor it does not know how to escape literals for, or custom prepareConnectionQueries were given without a matching dialect. The input at fault is an unsupported/unmapped this.config.dbType string.
Source
Thrown at packages/cubejs-jdbc-driver/src/JDBCDriver.ts:244
} else {
await this.pool._factory.destroy(connection);
}
}
protected prepareConnectionQueries() {
const dbTypeDescription = JDBCDriver.dbTypeDescription(this.config.dbType);
return this.config.prepareConnectionQueries ||
dbTypeDescription && dbTypeDescription.prepareConnectionQueries ||
[];
}
protected escapeDialect(): EscapeDialect {
const dbTypeDescription = JDBCDriver.dbTypeDescription(this.config.dbType);
if (dbTypeDescription?.escapeDialect) {
return dbTypeDescription.escapeDialect;
}
throw new Error(
`Unable to detect SQL escaping rules for db type "${this.config.dbType}"`
);
}
protected prepareQueryWithParams(query: string, values: unknown[]): string {
return format(this.escapeDialect(), query, values || []);
}
public async query<R = unknown>(query: string, values: unknown[]): Promise<R[]> {
const queryWithParams = this.prepareQueryWithParams(query, values);
const cancelObj: {cancel?: Function} = {};
const promise = this.queryPromised(queryWithParams, cancelObj, this.prepareConnectionQueries());
(promise as CancelablePromise<any>).cancel =
() => cancelObj.cancel && cancelObj.cancel() ||
Promise.reject(new Error('Statement is not ready'));
return promise;
}
View on GitHub (pinned to 7d981676b3)
Solutions
- Add the missing dbType to the JDBCDriver.dbTypeDescription registry (or a custom driver override) so it defines an escapeDialect
- Override escapeDialect() in a subclass to return the correct dialect for the configured database
- Verify this.config.dbType is spelled exactly as registered before instantiating the driver
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cubejs-jdbc-driver/src/JDBCDriver.ts:244 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/ce70502d763b4523.
Report an issue: GitHub.