{"record":{"id":"e07be2139ebfff05","repo":"can1357/oh-my-pi","slug":"cowork-transport-received-a-response-without-an-ht","errorCode":null,"errorMessage":"Cowork transport received a response without an HTTP status.","messagePattern":"Cowork transport received a response without an HTTP status\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ai/src/providers/cowork-fetch.ts","lineNumber":123,"sourceCode":"\tconst rawEncoding = message.headers[\"content-encoding\"];\n\tconst encoding = (Array.isArray(rawEncoding) ? rawEncoding[0] : rawEncoding)?.trim().toLowerCase();\n\tswitch (encoding) {\n\t\tcase \"gzip\":\n\t\t\treturn message.pipe(zlib.createGunzip());\n\t\tcase \"deflate\":\n\t\t\treturn message.pipe(zlib.createInflate());\n\t\tcase \"br\":\n\t\t\treturn message.pipe(zlib.createBrotliDecompress());\n\t\tcase \"zstd\":\n\t\t\treturn message.pipe(zlib.createZstdDecompress());\n\t\tdefault:\n\t\t\treturn message;\n\t}\n}\n\nfunction createResponse(message: IncomingMessage, method: string): Response {\n\tconst status = message.statusCode;\n\tif (status === undefined) throw new Error(\"Cowork transport received a response without an HTTP status.\");\n\tconst hasBody = method !== \"HEAD\" && status !== 204 && status !== 304;\n\tconst body = hasBody ? stream.Readable.toWeb(decodedResponseStream(message)) : null;\n\treturn new Response(body, {\n\t\tstatus,\n\t\tstatusText: message.statusMessage,\n\t\theaders: responseHeaders(message),\n\t});\n}\n\n/** Response headers worth naming when a provider rejects a request; `cf-ray` names the edge PoP. */\nconst DIAGNOSTIC_HEADERS = [\"cf-ray\", \"cf-mitigated\", \"server\", \"request-id\", \"retry-after\", \"x-should-retry\"];\n\nasync function sendCoworkRequest(\n\turl: URL,\n\tinit: CoworkRequestInit,\n\tsourceHeaders: Record<string, string>,\n\tbody: RequestBody | undefined,\n): Promise<Response> {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/ai/src/providers/cowork-fetch.ts#L105-L141","documentation":"The Cowork transport wraps raw HTTP messages into standard Response objects. If the incoming message has no statusCode (undefined), a valid Response cannot be constructed, so createResponse throws. This indicates a malformed or prematurely terminated transport response rather than an HTTP-level failure.","triggerScenarios":"The Cowork transport's IncomingMessage resolves with statusCode undefined — e.g. connection teardown before the status line was parsed, a non-HTTP response frame, or a transport bug emitting a message that never received a status.","commonSituations":"Server closes the socket mid-handshake; a proxy or firewall resets the connection; protocol desync after an upgrade; intermittent network instability during a long-running streaming call.","solutions":["Retry the request — this is typically a transient transport/connection issue.","Check network path (proxies, VPNs, load balancers) for connection resets between client and the Cowork endpoint.","Inspect server logs to confirm the endpoint is returning valid HTTP responses and not dropping connections.","Update the library/transport in case of a known protocol-parsing bug; report with a trace if reproducible."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  return await sendCoworkRequest(...);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"without an HTTP status\")) {\n    // transient transport failure: retry with backoff\n    await Bun.sleep(retryDelayMs);\n    return sendCoworkRequest(...);\n  }\n  throw err;\n}","preventionTips":["Build automatic retry with backoff around Cowork transport calls.","Monitor connection stability through proxies/firewalls.","Keep the transport library updated for protocol parsing fixes."],"tags":["network","transport","cowork","malformed-response"],"backgroundTag":"response-without-status-code","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}