“stream disconnected before completion” — what it means in Codex
Codex CLI — an error message defined in Codex's own open-source code, quoted verbatim. OpenAI's docs have no troubleshooting page for it, so everything below comes from that source file, the configuration reference, and replies on the openai/codex issue tracker, and each item says which.
The message
“stream disconnected before completion”
In Codex's source the message is “stream disconnected before completion: {0}”, where {0} is replaced by the cause. Users usually report it with the cause attached, for example “stream disconnected before completion: stream closed before response.completed”.
What it means
Codex had a working connection to the model, and the response stream then broke or went quiet before the reply finished. The source comment describes it as the stream disconnecting or erroring out after the HTTP handshake succeeded but before Codex finished receiving the completed response, and it says the session loop treats this as a transient error and automatically retries the turn. The words after the colon are the cause Codex recorded. Two that appear in the source are “stream closed before response.completed” and “idle timeout waiting for SSE”.
What you can do
- Give the automatic retry a chance first. The source comment says the turn is retried by itself, and the configuration reference lists
model_providers.<id>.stream_max_retries(“Retry count for SSE streaming interruptions (default: 5).”) andmodel_providers.<id>.stream_idle_timeout_ms(“Idle timeout for SSE streams in milliseconds (default: 300000).”). Those are per-provider settings in the reference; nothing found says that changing them fixes a particular case. - If it keeps coming back, look at your network path. On one user's report in the openai/codex tracker, a Codex team member (etraut-openai) replied: “This looks to me like a vanilla networking connectivity issue. Are you using Codex on a corporate network? If so, I recommend working with your IT team to investigate issues with routing, proxies, firewalls, etc.” That reply was about the logs that one user uploaded, not a general diagnosis.
- The same thread shows the message is not always the network. The same team member told one other user there that their log pointed to a server-side check that blocks conversations considered unsafe (called a likely false positive), and another that very long tool outputs were the suspect, with a suggested workaround of making tool-call output smaller.
- A content-filter stop uses the same prefix: the source defines “stream disconnected before completion: Incomplete response returned, reason: content_filter”.
- If many people hit it at once, the OpenAI status feed this site tracks is on /status/.
On this site: install Codex CLI · check your Codex usage · did Codex reset today? · OpenAI status
Also searched as
People look this message up in several ways. These are search wordings, not OpenAI's text:
- stream disconnected before completion: stream closed before response.completed
- Error: stream disconnected before completion: stream closed before response.completed
- stream closed before response.completed
- idle timeout waiting for SSE
The first two are titles of user reports on the openai/codex tracker (issues #41340 and #9995). The last two are texts from Codex's source that can appear after the colon.
Sources
- openai/codex source: codex-rs/protocol/src/error.rs — fetched 2026-11-09
- openai/codex source: codex-rs/codex-api/src/sse/responses.rs (the two causes) — fetched 2026-11-09
- Codex docs: Configuration Reference (stream_max_retries, stream_idle_timeout_ms) — fetched 2026-11-09
- openai/codex issue #9995: user report with the Codex-team replies quoted above — fetched 2026-11-09
- openai/codex issue #41340 (user report) — fetched 2026-11-09
This site is not affiliated with OpenAI. Where a statement above comes from a user report or a reply on the openai/codex issue tracker rather than documentation, it says so.
Frequently asked questions
What does “stream disconnected before completion” mean in Codex?
The response stream from the model broke, or went idle, after the connection was made but before Codex got the complete response. The source comment calls it a transient error and says the session retries the turn automatically. The cause is the text after the colon.
Does Codex retry after “stream disconnected before completion”?
Yes. The source comment says the session loop treats it as a transient error and will automatically retry the turn, and the configuration reference gives a default of 5 for the per-provider SSE streaming retry count.
Is “stream disconnected before completion” caused by my Codex usage limit?
Nothing in the source comment or the docs ties it to a usage limit; the comment describes a broken response stream. Usage limits are covered on /usage-limits/ and /usage-check/.