cube-js/cube · error · Error
Not implemented
Error message
Not implemented
What it means
convertTz(field) renders the SQL expression that converts a timestamp into the query's timezone. BaseQuery declares it abstract and throws 'Not implemented'; every concrete adapter must override it. Hitting this error means the code path ran against BaseQuery (or a subclass) that never implemented timezone conversion.
Source
Thrown at packages/cubejs-schema-compiler/src/adapter/BaseQuery.js:4124
*/
timestampFormat() {
return 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]';
}
/**
* @return {number}
*/
timestampPrecision() {
return 3;
}
/**
* @param {string} field
* @return {string}
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
convertTz(field) {
throw new Error('Not implemented');
}
/**
* URL-encode a SQL expression. Override in dialect-specific query classes
* for native URL encoding support. Default implementation uses REPLACE
* chains for the most common characters.
* @param {string} sql
* @return {string}
*/
urlEncode(sql) {
return `REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CAST(${sql} as TEXT), '%', '%25'), '&', '%26'), '=', '%3D'), '+', '%2B'), ' ', '%20')`;
}
/**
* @param {string} granularity
* @param {string} dimension
* @return {string}
*/View on GitHub (pinned to 7d981676b3)
Solutions
- Implement convertTz(field) in your adapter's query class to emit dialect-specific tz conversion SQL
- If no timezone conversion is desired, override to return the field as-is (document the caveat)
- Check you are instantiating the correct concrete query class, not BaseQuery directly
Example fix
// before (custom adapter)
class MyQuery extends BaseQuery {} // convertTz missing
// after
class MyQuery extends BaseQuery {
convertTz(field) { return `timezone('${this.timezone}', ${field})`; }
} Defensive patterns
Strategy: try-catch
Validate before calling
const q = adapter.createQuery({});
if (q.convertTz === BaseQuery.prototype.convertTz) {
throw new Error('Adapter must implement convertTz before serving timezone-aware queries');
} Type guard
function implementsConvertTz(adapter) {
return typeof adapter.convertTz === 'function' &&
adapter.convertTz !== BaseQuery.prototype.convertTz;
} Try / catch
try { return await cube.load(query); } catch (e) {
if (e.message === 'Not implemented' && stackIncludesConvertTz(e)) {
throw new Error('Data source adapter lacks timezone conversion support');
}
throw e;
} Prevention
- Implement convertTz first when writing a custom adapter
- Add an adapter smoke test that queries a timeDimension with a timezone
When it happens
Trigger: Compiling SQL involving timestamp granularity or timezone-aware dimensions using a query class that inherits BaseQuery.convertTz without overriding it (or a custom adapter forgot the override).
Common situations: Writing a custom data source driver based on BaseQuery and missing the convertTz override; queries that include timeDimensions triggering tz conversion on an incomplete custom dialect.
Related errors
- Value "${raw}" is not valid for CUBEJS_SCHEDULED_REFRESH_TIM
- Value "${value}" is not valid for CUBEJS_DEFAULT_TIMEZONE. M
- Unknown timezone: ${timezone}
- Timezone must be a string, got ${typeof value}
- Timezone must not be empty
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/bcc23484e835dcbc.
Report an issue: GitHub.