continuedev/continue · error · Error

No response body returned.

Error message

No response body returned.

What it means

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.

Source

Thrown at packages/fetch/src/stream.ts:22

  for await (const chunk of nodeReadable) {
    // @ts-ignore
    yield chunk as Uint8Array;
  }
}

export async function* streamResponse(
  response: Response,
): AsyncGenerator<string> {
  if (response.status === 499) {
    return; // In case of client-side cancellation, just return
  }

  if (response.status !== 200) {
    throw new Error(await response.text());
  }

  if (!response.body) {
    throw new Error("No response body returned.");
  }

  // Get the major version of Node.js
  const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10);
  let chunks = 0;

  try {
    if (nodeMajorVersion >= 20) {
      // Use the new API for Node 20 and above
      const stream = (ReadableStream as any).from(response.body);
      for await (const chunk of stream.pipeThrough(
        new TextDecoderStream("utf-8"),
      )) {
        yield chunk;
        chunks++;
      }
    } else {
      // Fallback for Node versions below 20

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Check response.body truthiness before calling streamSse/streamJSON and fall back to response.text()/json()
  2. Verify with curl that the endpoint actually streams data
  3. Use Node 18+ so Response.body is a web ReadableStream
  4. Fix mocks/tests to include a body

Example fix

// before
const chunks = []; for await (const c of streamSse(response)) chunks.push(c);

// after
if (!response.body) { return JSON.parse(await response.text()); }
const chunks = []; for await (const c of streamSse(response)) chunks.push(c);
Defensive patterns

Strategy: validation

Validate before calling

if (!response.body) { return JSON.parse(await response.text()); }

Type guard

function hasBody(r: Response): r is Response & { body: ReadableStream } { return r.body instanceof ReadableStream; }

Try / catch

try { for await (const c of streamSse(response)) {} } catch (e) { if (/No response body/.test(e.message)) { /* fallback to non-streaming */ } else throw e; }

Prevention

When it happens

Trigger: Server returns 200 with no body (Content-Length: 0), or a fetch polyfill/Node version that doesn't expose ReadableStream on the response.

Common situations: Misbehaving proxies stripping bodies, Node < 18 without proper undici streams, or testing with mocked fetch that omits body.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/dfb5f9177055b4e0. Report an issue: GitHub.