can1357/oh-my-pi · error · Error

Cowork transport received a response without an HTTP status.

Error message

Cowork transport received a response without an HTTP status.

What it means

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.

Source

Thrown at packages/ai/src/providers/cowork-fetch.ts:123

	const rawEncoding = message.headers["content-encoding"];
	const encoding = (Array.isArray(rawEncoding) ? rawEncoding[0] : rawEncoding)?.trim().toLowerCase();
	switch (encoding) {
		case "gzip":
			return message.pipe(zlib.createGunzip());
		case "deflate":
			return message.pipe(zlib.createInflate());
		case "br":
			return message.pipe(zlib.createBrotliDecompress());
		case "zstd":
			return message.pipe(zlib.createZstdDecompress());
		default:
			return message;
	}
}

function createResponse(message: IncomingMessage, method: string): Response {
	const status = message.statusCode;
	if (status === undefined) throw new Error("Cowork transport received a response without an HTTP status.");
	const hasBody = method !== "HEAD" && status !== 204 && status !== 304;
	const body = hasBody ? stream.Readable.toWeb(decodedResponseStream(message)) : null;
	return new Response(body, {
		status,
		statusText: message.statusMessage,
		headers: responseHeaders(message),
	});
}

/** Response headers worth naming when a provider rejects a request; `cf-ray` names the edge PoP. */
const DIAGNOSTIC_HEADERS = ["cf-ray", "cf-mitigated", "server", "request-id", "retry-after", "x-should-retry"];

async function sendCoworkRequest(
	url: URL,
	init: CoworkRequestInit,
	sourceHeaders: Record<string, string>,
	body: RequestBody | undefined,
): Promise<Response> {

View on GitHub (pinned to 9690622007)

Solutions

  1. Retry the request — this is typically a transient transport/connection issue.
  2. Check network path (proxies, VPNs, load balancers) for connection resets between client and the Cowork endpoint.
  3. Inspect server logs to confirm the endpoint is returning valid HTTP responses and not dropping connections.
  4. Update the library/transport in case of a known protocol-parsing bug; report with a trace if reproducible.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  return await sendCoworkRequest(...);
} catch (err) {
  if (err instanceof Error && err.message.includes("without an HTTP status")) {
    // transient transport failure: retry with backoff
    await Bun.sleep(retryDelayMs);
    return sendCoworkRequest(...);
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/e07be2139ebfff05. Report an issue: GitHub.