{"record":{"id":"dfb5f9177055b4e0","repo":"continuedev/continue","slug":"no-response-body-returned","errorCode":null,"errorMessage":"No response body returned.","messagePattern":"No response body returned\\.","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/fetch/src/stream.ts","lineNumber":22,"sourceCode":"  for await (const chunk of nodeReadable) {\n    // @ts-ignore\n    yield chunk as Uint8Array;\n  }\n}\n\nexport async function* streamResponse(\n  response: Response,\n): AsyncGenerator<string> {\n  if (response.status === 499) {\n    return; // In case of client-side cancellation, just return\n  }\n\n  if (response.status !== 200) {\n    throw new Error(await response.text());\n  }\n\n  if (!response.body) {\n    throw new Error(\"No response body returned.\");\n  }\n\n  // Get the major version of Node.js\n  const nodeMajorVersion = parseInt(process.versions.node.split(\".\")[0], 10);\n  let chunks = 0;\n\n  try {\n    if (nodeMajorVersion >= 20) {\n      // Use the new API for Node 20 and above\n      const stream = (ReadableStream as any).from(response.body);\n      for await (const chunk of stream.pipeThrough(\n        new TextDecoderStream(\"utf-8\"),\n      )) {\n        yield chunk;\n        chunks++;\n      }\n    } else {\n      // Fallback for Node versions below 20","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/fetch/src/stream.ts#L4-L40","documentation":"After a 200 response, streamResponse requires a body to iterate; if response.body is null/undefined (e.g. empty 200 response or an environment without streams), it throws this.","triggerScenarios":"Server returns 200 with no body (Content-Length: 0), or a fetch polyfill/Node version that doesn't expose ReadableStream on the response.","commonSituations":"Misbehaving proxies stripping bodies, Node < 18 without proper undici streams, or testing with mocked fetch that omits body.","solutions":["Check response.body truthiness before calling streamSse/streamJSON and fall back to response.text()/json()","Verify with curl that the endpoint actually streams data","Use Node 18+ so Response.body is a web ReadableStream","Fix mocks/tests to include a body"],"exampleFix":"// before\nconst chunks = []; for await (const c of streamSse(response)) chunks.push(c);\n\n// after\nif (!response.body) { return JSON.parse(await response.text()); }\nconst chunks = []; for await (const c of streamSse(response)) chunks.push(c);","handlingStrategy":"validation","validationCode":"if (!response.body) { return JSON.parse(await response.text()); }","typeGuard":"function hasBody(r: Response): r is Response & { body: ReadableStream } { return r.body instanceof ReadableStream; }","tryCatchPattern":"try { for await (const c of streamSse(response)) {} } catch (e) { if (/No response body/.test(e.message)) { /* fallback to non-streaming */ } else throw e; }","preventionTips":["Check response.body truthiness before streaming","Use Node 18+ for native ReadableStream on Response","Make fetch mocks return a body"],"tags":["fetch","streaming","empty-response","node"],"backgroundTag":"empty-response-body","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}