“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

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:

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

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/.