cube-js/cube · info
Query cancelled
Error message
Query cancelled
What it means
DruidClient.query() tracks whether the caller cancelled the query. If cancellation is detected and the successful HTTP response still carries an x-druid-sql-query-id header, the client cancels the running Druid SQL query server-side and then throws 'Query cancelled' instead of returning the (unwanted) results.
Source
Thrown at packages/cubejs-druid-driver/src/DruidClient.ts:69
};
try {
const response = await this.getClient().request({
url: '/druid/v2/sql/',
method: 'POST',
data: {
query,
parameters,
header: true,
sqlTypesHeader: true,
resultFormat: 'object',
},
});
if (cancelled && response.headers['x-druid-sql-query-id']) {
await this.cancel(response.headers['x-druid-sql-query-id']);
throw new Error('Query cancelled');
}
if (response.headers['x-druid-sql-header-included']) {
const [columns, ...rows] = response.data;
return {
columns,
rows
};
} else {
return {
columns: null,
rows: response.data,
};
}
} catch (e: any) {
if (cancelled) {
throw new Error('Query cancelled');View on GitHub (pinned to 7d981676b3)
Solutions
- Nothing is wrong per se — handle/rethrow cancellation in your error handling and filter it from retry logic.
- Increase the query timeout or orchestrator concurrency limits if cancellations are unwanted.
- Check for abandoned dashboard queries causing mass cancellation; reduce pre-aggregation/query churn.
Example fix
// before
catch (e) { console.error(e); }
// after
catch (e) {
if (e.message === 'Query cancelled') return; // expected on abort
console.error(e);
} Defensive patterns
Strategy: try-catch
Type guard
function isQueryCancelled(e) {
return e instanceof Error && e.message === 'Query cancelled';
} Try / catch
try {
await druidDriver.query(query, values);
} catch (e) {
if (e.message === 'Query cancelled') return null; // expected on abort
throw e;
} Prevention
- Avoid cancelling queries unnecessarily; tune queryTimeout and queue settings
- Filter cancellation errors from retry/alerting pipelines
- Monitor cancellation frequency to detect dashboard churn
When it happens
Trigger: Calling driver.query()/client.query() and cancelling the request (e.g. via an abort signal or cancel callback) while the HTTP response arrives with an x-druid-sql-query-id header, so the client aborts the query and throws instead of returning rows.
Common situations: Users navigating away in a dashboard causing Cube to cancel in-flight queries; query queue timeouts cancelling Druid queries; long-running Druid SQL calls cancelled by the orchestrator.
Related errors
- CancelToken was already canceled
- Query was cancelled
- CubeSQL query was aborted
- aborted
- Job ${jobId} has been canceled
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/50cec15aa591ac8d.
Report an issue: GitHub.