Skip to content

stream disconnected before completion Codex

Quick fix

Upgrade cc-switch to v3.14.0 or later to fix connection drops caused by proxy forwarding hop-by-hop response headers.

Error output
stream disconnected before completion: error sending request for url (http://127.0.0.1:15721/v1/responses)

When using cc-switch as a local proxy, older versions forward hop-by-hop response headers (e.g., Connection, Keep-Alive, Transfer-Encoding) from the upstream API directly to downstream clients. This causes the underlying axum/hyper server to receive unexpected request headers and disconnect immediately, manifesting as stream disconnected or Empty reply from server. This issue is fixed in v3.14.0 by automatically stripping these response headers.

  1. Upgrade cc-switch to v3.14.0 or later. This version includes the Proxy Hop-by-Hop Header Stripping update, which automatically handles response headers causing disconnections.

ToolCodex
Version< 3.14.0
PlatformsmacOS
Why does direct access to the upstream API work, but accessing it via the cc-switch proxy results in an error?
Direct access returns normal 200 responses from the upstream. However, when using an older version of the cc-switch proxy, it forwards hop-by-hop response headers from the upstream unchanged, causing the local proxy server (axum/hyper) to error out and disconnect. Upgrading to v3.14.0 resolves this.
What should I do if I still encounter stream disconnected after upgrading to v3.14.0?
If the issue persists after upgrading, please provide specific details about the upstream provider, API format, and the latest runtime logs for further troubleshooting.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.