cube-js/cube · error

Query was cancelled

Error message

Query was cancelled

What it means

Sentinel error in SnowflakeDriver.executeCancelable: the CancelablePromise wrapper tracked a cancellation that happened while the driver was still awaiting the Connection promise. Instead of opening a connection just to immediately cancel, the wrapper throws this error without ever issuing the SQL statement.

Source

Thrown at packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts:1029

      }
    });
  }

  protected executeCancelable<R>(
    connectionPromise: Promise<Connection>,
    options: Omit<StatementOption, 'complete'>,
    onComplete: (stmt: RowStatement, rows: any[] | undefined) => R | PromiseLike<R>,
  ): CancelablePromise<R> {
    let stmt: RowStatement | undefined;
    let cancelled = false;
    let settled = false;

    const promise = <CancelablePromise<R>>(async () => {
      const connection = await connectionPromise;

      if (cancelled) {
        // Cancelled while we were still connecting - never issue the statement.
        throw new Error('Query was cancelled');
      }

      return new Promise<R>((resolve, reject) => {
        stmt = connection.execute({
          ...options,
          complete: (err, statement, rows) => {
            settled = true;

            if (cancelled) {
              // Snowflake reports its own `SQL execution canceled.` here.
              // Normalize it so callers see one consistent message, and so a
              // query that happened to succeed microseconds before the abort
              // landed does not return a result nobody is waiting for anymore.
              reject(new Error('Query was cancelled'));
              return;
            }

            if (err) {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Handle this error in callers that cancel queries (e.g. timeouts or client aborts); it signals the query never ran, not a driver failure.
  2. If cancellations are unexpected, review orchestrator query timeouts and request cancellation settings.
  3. Retry the query with a longer timeout if cancellation was caused by a premature timeout.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts:1029 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/64cac47800822e0f. Report an issue: GitHub.