| Error | stream disconnected before completion: <reason> |
|---|---|
| Common reasons | stream closed before response.completed, idle timeout waiting for SSE, idle timeout waiting for websocket, websocket closed by server before response.completed |
| In Codex's source | A transient error: Codex retries it with backoff before showing it |
| Defaults | 5 stream retries and a 300,000 ms (5 minute) idle timeout per provider; retries are capped at 100 |
| Fix | Retry in a new chat; check for capacity errors; on a custom provider, raise stream_idle_timeout_ms / stream_max_retries and check the gateway |
| Reports | 8 people on GitHub, 26 Nov to 4 Dec 2026, on Windows, macOS and Linux. No OpenAI reply on these issues |
| Checked | 5 Dec 2026, against the sources listed below |
Read the reason after the colon
| Text after the colon | What it means |
|---|---|
stream closed before response.completed | The stream ended without the final "completed" event. Set in codex-api/src/sse/responses.rs (line 639) and the WebSocket client. |
idle timeout waiting for SSE | No data arrived for the whole idle timeout (default 300,000 ms) on an HTTP stream (sse/responses.rs, line 645). |
idle timeout waiting for websocket | The same timeout on the WebSocket connection (endpoint/responses_websocket.rs, line 1118). Reported in Plan mode with GPT-6.2 Astra Ultra, right when Codex finished its analysis and started writing the plan (#65419, #65623). |
websocket closed by server before response.completed | The server closed the WebSocket mid-response (responses_websocket.rs, line 1296). Reported together with "Selected model is at capacity" (#65683). |
Incomplete response returned, reason: content_filter | A content filter stopped the response (protocol/src/error.rs, line 148). Codex adds guidance to the conversation and retries. |
tls handshake eof, IO error: An established connection was aborted by the software in your host machine. (os error 10053), Transport error: network error: error decoding response body | Network-level failures quoted by users (#64434, #65213, #65235). The Windows 10053 text itself says software on your own machine aborted the connection. |
Fix it
- Let the retries finish. Codex's source describes this error as a disconnect "after the HTTP handshake has succeeded but before it finished emitting
response.completed", and says "The Session loop treats this as a transient error and will automatically retry the turn." By default it tries 5 times, showingReconnecting... 1/5and so on. After that it can switch transports and warnFalling back from WebSockets to HTTPS transport. - Check the lines just above it. If you also see
Selected model is at capacity. Please try a different model., the server is overloaded and the disconnect is a side effect: see Selected model is at capacity. Several reporters here saw both (#64434, #65683). - Start a new chat with a smaller prompt. OpenAI's troubleshooting page suggests this for stuck chats. A Windows user reports that fresh sessions in the same workspace generally worked while some sessions left idle for hours kept reconnecting (#65213).
- Custom provider or gateway: raise its limits.
stream_idle_timeout_ms(default 300000) andstream_max_retries(default 5) are per-provider keys under[model_providers.<id>]inconfig.toml:
The values are an example. They don't apply to ChatGPT sign-in: Codex rejects config that redefines a built-in provider ("Built-in providers cannot be overridden"). Raising retries isn't a sure fix either: in #65235, a custom provider with[model_providers.my-gateway] # keep your existing name, base_url, wire_api and env_key lines stream_idle_timeout_ms = 600000 stream_max_retries = 10stream_max_retries = 10still failed onerror decoding response bodywith no visible retry. - Find the gateway's real error. In #64124, a gateway user found five different causes (upstream 4xx/5xx, a socket reset, a 300 s gateway timeout, a context-size reject, a safety-screening 503) all shown as the same Codex message. A commenter's tip: send a small streaming request straight to the gateway and read the raw response, since Codex posts to
{base_url}/responses:
An HTTP error with a JSON body means the upstream error passed through; ancurl -N -sS "$BASE_URL/responses" \ -H "Authorization: Bearer $KEY" -H "content-type: application/json" \ -d '{"model":"MODEL_ID","input":"Reply with: pong","stream":true}'event: errororresponse.failedin the stream carries the gateway's own text; a reset or "transfer closed" points at a dropped socket or a gateway timeout. - Plan mode stalls the same way every time? No fix has been posted. In #65623 retrying reached the same stage and failed again. Send
/feedbackfrom that chat so OpenAI gets the session.
Why the message is so vague
Every one of these failures is one error type in Codex (CodexErrorDetails::Stream), so the text after the colon is the only detail you get. Two open issues ask for better reporting: #64124 wants the underlying provider error shown, and #64403 notes that apps built on the Codex app-server receive these disconnects as codexErrorInfo: "other".
Running Claude Code, Codex or Cursor on real repos, or shipping an AI agent? A Quick Review ($149 / ₹13,900, 1 working day) checks one repo, config or setup for leaked keys, risky agent permissions and MCP servers. Request a Quick Review
FAQ
What does 'stream disconnected before completion' mean in Codex?
The response stream dropped after it started and before the final response.completed event. Codex treats it as transient, retries (5 times by default), and shows this error when the retries run out.
What is 'idle timeout waiting for websocket'?
No data arrived on the WebSocket connection for the idle timeout, which is 300,000 ms (5 minutes) by default. Users hit it in long Plan-mode turns.
Can I raise Codex's stream retries or timeout?
Only for a custom provider: stream_max_retries and stream_idle_timeout_ms under [model_providers.<id>] in config.toml. Built-in providers, including ChatGPT sign-in, can't be overridden.
Why does it say Reconnecting 1/5?
That's Codex retrying the dropped stream. 5 is the default stream_max_retries.
Is it the same as 'Selected model is at capacity'?
No, but they often appear together. Capacity is a server overload; the disconnect can follow it.
Related errors
- Codex: Selected model is at capacity
- Codex not working on Windows
- Codex: model is not supported when using Codex with a ChatGPT account
Sources
Read 5 Dec 2026. These tools change often: if a step no longer matches, the linked page wins.
- Codex source: Stream error, transient, auto-retried (protocol/src/error.rs L137-L148): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/protocol/src/error.rs#L137-L148
- Codex source: retry policy Backoff for Stream (protocol/src/error.rs L564): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/protocol/src/error.rs#L564
- Codex source: Reconnecting N/M and HTTPS fallback (core/src/responses_retry.rs L140-L185): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/core/src/responses_retry.rs#L140-L185
- Codex source: defaults 300000 ms, 5 retries, cap 100 (model-provider-info/src/lib.rs L74-L81): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/model-provider-info/src/lib.rs#L74-L81
- Codex source: SSE reasons (codex-api/src/sse/responses.rs L639-L645): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/codex-api/src/sse/responses.rs#L639-L645
- Codex source: WebSocket reasons (codex-api/src/endpoint/responses_websocket.rs L1118, L1296): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/codex-api/src/endpoint/responses_websocket.rs#L1118
- Codex source: built-in providers cannot be overridden (config/src/config_toml.rs L988-L989): github.com/openai/codex/blob/3ce8141ab3590a1afb0e5845e2e1e90647f36910/codex-rs/config/src/config_toml.rs#L988-L989
- OpenAI docs: Codex config reference (stream_idle_timeout_ms, stream_max_retries): developers.openai.com/codex/config-reference
- OpenAI docs: Codex troubleshooting (stuck chats, feedback): learn.chatgpt.com/docs/reference/troubleshooting
- openai/codex #64124 (one message, five gateway causes; curl tip): github.com/openai/codex/issues/64124
- openai/codex #65623 (Plan mode, idle timeout waiting for websocket): github.com/openai/codex/issues/65623
- openai/codex #65213 (os error 10053, Reconnecting 5/5, fresh sessions work): github.com/openai/codex/issues/65213
- openai/codex #65235 (custom provider, stream_max_retries = 10): github.com/openai/codex/issues/65235
- openai/codex #65683 (websocket closed by server, capacity errors): github.com/openai/codex/issues/65683
- reviewready CLI: one command that checks an AI app repo before it ships
- MCP config checker: scan your mcp.json for hard-coded tokens, unpinned servers and risky access
- Exposed API key checker: find API keys committed to a repo or shipped to the browser