{"record":{"id":"c565ce7e6e66ab48","repo":"deepseek-ai/deepseek-harness","slug":"stream-closed","errorCode":"STREAM_CLOSED","errorMessage":"SSE stream ended without [DONE]","messagePattern":"SSE stream ended without \\[DONE\\]","errorType":"exception","errorClass":"LlmError","httpStatus":null,"severity":"error","filePath":"packages/llm/llm-deepseek/src/sse.ts","lineNumber":39,"sourceCode":" * Parse an SSE byte stream into data payloads. Yields `[DONE]` as the final\n * value and returns; throws `LlmError('STREAM_CLOSED')` when the stream ends\n * without it (truncated response — the model call cannot be trusted).\n * @param stream - raw SSE bytes; reads may split anywhere, including mid-UTF-8 sequence.\n * @param onComment - optional transport-activity callback; comments never enter the yielded payload stream.\n * @returns each event's data payload in arrival order, the `[DONE]` sentinel last.\n */\nexport async function* parseSse(\n  stream: ReadableStream<BufferSource>,\n  onComment?: (comment: string) => void,\n): AsyncGenerator<string> {\n  const events = stream\n    .pipeThrough(new TextDecoderStream())\n    .pipeThrough(new EventSourceParserStream({ onComment }))\n  for await (const { data } of events) {\n    yield data\n    if (data === DONE) return\n  }\n  throw new LlmError('SSE stream ended without [DONE]', 'STREAM_CLOSED')\n}\n","sourceCodeStart":21,"sourceCodeEnd":41,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/llm/llm-deepseek/src/sse.ts#L21-L41","documentation":"Error \"SSE stream ended without [DONE]\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/llm/llm-deepseek/src/sse.ts:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; the SSE connection ended before the [DONE] marker."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}