cube-js/cube · error · Error

Query cancelled

Error message

Query cancelled

What it means

In MongoBIDriver.withConnection, cancelObj.cancel flips a `cancelled` flag and issues SHOW PROCESSLIST / KILL of long-running (Time >= 599s) connections; after cancellation the pending query promise is rejected with 'Query cancelled'. It means the orchestrator (or a timeout) actively aborted the in-flight Mongo BI query, not that the query itself failed — downstream code should treat it as an expected cancellation and typically retry or propagate ContinueWait-like semantics rather than surfacing it as a data error.

Source

Thrown at packages/cubejs-mongobi-driver/src/MongoBIDriver.ts:169

    let cancelled = false;
    const cancelObj: any = {};
    const promise: any = connectionPromise.then(conn => {
      cancelObj.cancel = async () => {
        cancelled = true;
        await self.withConnection(async processConnection => {
          const processRows: any = await processConnection.promise().query({
            sql: 'SHOW PROCESSLIST'
          });
          await Promise.all(processRows.filter((row: any) => row.Time >= 599)
            .map((row: any) => processConnection.promise().query({
              sql: `KILL ${row.Id}`
            })));
        });
      };
      return fn(conn)
        .then(res => this.pool.release(conn).then(() => {
          if (cancelled) {
            throw new Error('Query cancelled');
          }
          return res;
        }))
        .catch((err) => this.pool.release(conn).then(() => {
          if (cancelled) {
            throw new Error('Query cancelled');
          }
          throw err;
        }));
    });
    promise.cancel = () => cancelObj.cancel();
    return promise;
  }

  public async testConnection() {
    // eslint-disable-next-line no-underscore-dangle
    const conn: Connection = await (<any> this.pool)._factory.create();
    try {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. This fires when cancelObj.cancel() was invoked and the query fn checks the cancelled flag before returning results; no action needed if cancellation was intentional
  2. If queries are cancelled unexpectedly, inspect who calls cancel (query timeout, client abort) and raise continueWaitTimeout/orchestrator timeouts
  3. If the KILL via SHOW PROCESSLIST failed, verify the BI user has PROCESS/KILL privileges on the MongoDB BI connector
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-mongobi-driver/src/MongoBIDriver.ts:169 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/7ccf10ac7ce1ac86. Report an issue: GitHub.