{"record":{"id":"c7bbcb30e26acd66","repo":"cube-js/cube","slug":"aborted","errorCode":null,"errorMessage":"aborted","messagePattern":"aborted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/cubejs-client-core/src/index.ts","lineNumber":970,"sourceCode":"              type: 'data' as const,\n              data: parsed.data\n            };\n          } else if (parsed.error) {\n            yield {\n              type: 'error' as const,\n              error: parsed.error\n            };\n          }\n        } catch (parseError) {\n          yield {\n            type: 'error' as const,\n            error: `Failed to parse remaining JSON: ${buffer}`\n          };\n        }\n      }\n    } catch (error: any) {\n      if (error.name === 'AbortError') {\n        throw new Error('aborted');\n      }\n      throw error;\n    } finally {\n      if (streamResponse.unsubscribe) {\n        await streamResponse.unsubscribe();\n      }\n    }\n  }\n}\n\nexport default (apiToken: string | (() => Promise<string>), options: CubeApiOptions) => new CubeApi(apiToken, options);\n\nexport { CubeApi };\nexport { default as Meta } from './Meta.js';\nexport { default as SqlQuery } from './SqlQuery.js';\nexport { default as RequestError } from './RequestError.js';\nexport { default as ProgressResult } from './ProgressResult.js';\nexport { default as ResultSet } from './ResultSet.js';","sourceCodeStart":952,"sourceCodeEnd":988,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-client-core/src/index.ts#L952-L988","documentation":"Inside cubeSqlStream(), an AbortError raised while consuming the JSONL stream is normalized to a plain Error with message 'aborted', matching the non-streaming cubeSql classification. It signals the caller cancelled the stream.","triggerScenarios":"Aborting the AbortSignal passed as options.signal while cubeSqlStream is still yielding chunks (e.g. breaking early plus abort, or external abort).","commonSituations":"Cancelling live queries in UIs; component unmount cleanup; combining early generator return with controller.abort().","solutions":["Catch and treat 'aborted' as expected cancellation when using signals","Abort only after fully consuming or intentionally stopping the stream","Avoid aborting when you still need the remaining rows"],"exampleFix":"// before\nconst stream = client.cubeSqlStream(sql, { signal });\ncontroller.abort(); // mid-consumption, unhandled\n// after\ntry {\n  for await (const chunk of client.cubeSqlStream(sql, { signal })) { /* ... */ }\n} catch (e) {\n  if (e.message === 'aborted') return; // expected cancellation\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  for await (const chunk of client.cubeSqlStream(sql, { signal })) { /* ... */ }\n} catch (e) {\n  if (e.message === 'aborted') return; // expected cancellation, not an error\n  throw e;\n}","preventionTips":["Abort streams only when cancellation is intentional","Handle early generator returns with try/finally around consumption","Keep AbortController scoped to a single stream request"],"tags":["cubesql","streaming","abort","cancellation"],"backgroundTag":"request-aborted","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}