{"record":{"id":"354dae3440b9a382","repo":"cube-js/cube","slug":"lambda-query-errors-errors-join","errorCode":null,"errorMessage":"Lambda query errors ${errors.join(', ')}","messagePattern":"Lambda query errors (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts","lineNumber":697,"sourceCode":"\n  protected async csvQuery(client, q) {\n    const headers = q.lambdaTypes.map(c => c.name);\n    const writer = csvWriter({\n      headers,\n      sendHeaders: false,\n    });\n    let tableData;\n    try {\n      if (client.stream) {\n        tableData = await client.stream(q.query, q.values, q);\n        const errors = [];\n        await pipeline(tableData.rowStream, writer, (err) => {\n          if (err) {\n            errors.push(err);\n          }\n        });\n        if (errors.length > 0) {\n          throw new Error(`Lambda query errors ${errors.join(', ')}`);\n        }\n      } else {\n        tableData = await client.downloadQueryResults(q.query, q.values, q);\n        tableData.rows.forEach(\n          row => writer.write(row)\n        );\n        writer.end();\n      }\n    } finally {\n      if (tableData?.release) {\n        await tableData.release();\n      }\n    }\n    const lines = await streamToArray(writer);\n    const rowCount = lines.length;\n    const csvRows = lines.join('');\n    return {\n      types: q.lambdaTypes,","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts#L679-L715","documentation":"In QueryCache.csvQuery, the streaming pipeline (rowStream -> csv writer) collects any pipeline errors and, if any occurred, throws a combined 'Lambda query errors ...' message listing them. It aggregates failures from streaming pre-aggregation/lambda query rows — typically driver-level stream errors, serialization failures, or premature stream termination — into one error for the queue caller (getQueue).","triggerScenarios":"Thrown at packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts:697 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the collected pipeline errors — they usually indicate the destination stream (CSV writer/upload) failed mid-flight, not the query itself","Check for premature stream close, disk-full, or Cube Store upload failures in the error chain and fix the downstream sink","If the row stream aborted due to the source driver, look at the driver-level error wrapped inside errors[]"],"exampleFix":null,"handlingStrategy":"try-catch","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"}