{"record":{"id":"03432cb52857fad6","repo":"cube-js/cube","slug":"query-cancelled-03432c","errorCode":null,"errorMessage":"Query cancelled","messagePattern":"Query cancelled","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-mysql-driver/src/MySqlDriver.ts","lineNumber":256,"sourceCode":"  protected withConnection(fn: (conn: MySQLConnection) => Promise<any>) {\n    const self = this;\n    const connectionPromise = this.pool.acquire();\n\n    let cancelled = false;\n    const cancelObj: any = {};\n\n    const promise: any = connectionPromise.then(async conn => {\n      const [{ connectionId }] = await conn.execute('select connection_id() as connectionId');\n      cancelObj.cancel = async () => {\n        cancelled = true;\n        await self.withConnection(async processConnection => {\n          await processConnection.execute(`KILL ${connectionId}`);\n        });\n      };\n      return fn(conn)\n        .then(res => this.pool.release(conn).then(() => {\n          if (cancelled) {\n            throw new Error('Query cancelled');\n          }\n          return res;\n        }))\n        .catch((err) => this.pool.release(conn).then(() => {\n          if (cancelled) {\n            throw new Error('Query cancelled');\n          }\n          throw err;\n        }));\n    });\n    promise.cancel = () => cancelObj.cancel();\n    return promise;\n  }\n\n  public async testConnection() {\n    // eslint-disable-next-line no-underscore-dangle\n    const conn: MySQLConnection = await (<any> this.pool)._factory.create();\n","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-mysql-driver/src/MySqlDriver.ts#L238-L274","documentation":"In MySqlDriver.withConnection, cancelObj.cancel KILLs the connection by its `select connection_id()` id; once cancelled the pending query promise rejects with 'Query cancelled'. This is an active abort of an in-flight MySQL query by the orchestrator or a timeout — the query did not fail on the server. Callers should treat it as cancellation semantics (retry if results are needed) rather than a data or SQL error.","triggerScenarios":"Thrown at packages/cubejs-mysql-driver/src/MySqlDriver.ts:256 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fires only because cancel() ran and the cancelled flag was set before fn() returned — expected behaviour for intentional cancellation","If cancellation is unexpected, check query timeouts (executionTimeout, continueWaitTimeout) and client aborts that trigger KILL connection_id()","Verify the MySQL user can run KILL; a failed KILL leaves the query running while the client still sees 'Query cancelled'"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}