{"record":{"id":"cda5e6f547f6a6c7","repo":"windmill-labs/windmill","slug":"no-response-body-for-sse-stream","errorCode":null,"errorMessage":"No response body for SSE stream","messagePattern":"No response body for SSE stream","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/app/dev.ts","lineNumber":1984,"sourceCode":"  const response = await fetch(sseUrl, {\n    headers: {\n      Accept: \"text/event-stream\",\n      Authorization: `Bearer ${token}`,\n      ...extraHeaders,\n    },\n  });\n\n  await detectAuthGatewayChallenge(response, sseUrl);\n\n  if (!response.ok) {\n    throw new Error(\n      `SSE request failed: ${response.status} ${response.statusText}`,\n    );\n  }\n\n  const reader = response.body?.getReader();\n  if (!reader) {\n    throw new Error(\"No response body for SSE stream\");\n  }\n\n  const decoder = new TextDecoder();\n  let buffer = \"\";\n\n  try {\n    while (true) {\n      const { done, value } = await reader.read();\n      if (done) break;\n\n      buffer += decoder.decode(value, { stream: true });\n      const lines = buffer.split(\"\\n\");\n      buffer = lines.pop() || \"\";\n\n      for (const line of lines) {\n        if (line.startsWith(\"data: \")) {\n          const data = line.slice(6);\n          try {","sourceCodeStart":1966,"sourceCodeEnd":2002,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/app/dev.ts#L1966-L2002","documentation":"The Windmill CLI's `wmill app dev` command streams run/job updates from the backend via Server-Sent Events (`/jobs_u/getupdate_sse/<jobId>`). After the fetch succeeds (HTTP status OK and no auth-gateway challenge), it calls `response.body.getReader()`; if the response has no readable body it throws this error, because there is no stream to forward to the browser WebSocket.","triggerScenarios":"Calling the SSE endpoint on a server or fetch runtime that returns a null `response.body` — e.g. an unexpected HTTP method/result, a proxy that stripped or buffered the body, or a runtime whose fetch implementation does not expose a ReadableStream for streaming responses.","commonSituations":"Corporate proxies or auth gateways in front of the Windmill instance intercepting the event-stream request; misconfigured reverse proxy returning an empty 200; running the CLI in a Node/Deno version with limited streaming fetch support; a redirect to a login page that returns OK with an HTML body-less response.","solutions":["Check that the URL is reachable and returns a real `text/event-stream` response (curl -N the SSE URL with a Bearer token).","Verify no proxy/auth gateway intercepts the response; check `detectAuthGatewayChallenge` output and instance base URL (`--baseUrl`).","Upgrade the CLI runtime (Node/Deno/Bun) to a version with full streaming fetch support.","Retry the `wmill app dev` command; if persistent, capture the raw response with curl and inspect headers/body."],"exampleFix":"// defensive: report status when body is missing\nconst reader = response.body?.getReader();\nif (!reader) {\n  throw new Error(`No response body for SSE stream (status ${response.status}, content-type ${response.headers.get('content-type')})`);\n}","handlingStrategy":"try-catch","validationCode":"const res = await fetch(sseUrl, { headers: { Accept: 'text/event-stream', Authorization: `Bearer ${token}` } });\nif (!res.ok || !res.body) throw new Error(`SSE unavailable: ${res.status}`);","typeGuard":"function hasBody(r: Response): r is Response & { body: ReadableStream } { return r.body !== null; }","tryCatchPattern":"try { await streamJobWithSSE(...) } catch (e) { if (String(e).includes('No response body')) fallbackToPolling(jobId); else throw e; }","preventionTips":["Verify the SSE endpoint with curl -N before automating against it","Check for proxy/auth-gateway interference with streaming responses","Use a runtime with full streaming fetch support (modern Node 18+/Deno/Bun)","Implement a polling fallback for job status when SSE fails"],"tags":["network","sse","streaming","cli"],"backgroundTag":"sse-stream-no-body","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}