AI coding · fixes ·

Codex “stream disconnected before completion”: how to fix

As of 24 October 2026. This is a fast-moving problem. OpenAI may change things at any time, so check the linked issues before you follow any step.

If you want the next step, read Codex “Selected model is at capacity”: what to do.

If Codex stops a turn with this message, you're not alone:

stream disconnected before completion: An error occurred while processing your request. You can retry your request, or contact us through our help center at help.openai.com if the error persists. Please include the request ID e245f2c8-8fc9-490a-b1f8-728dccaf4057 in your message.

That's the full error quoted in openai/codex #53777 (opened 13 Oct 2026) from the Codex Windows desktop app, version 26.1007.21434. Your request ID will differ. The reporter says: "Retrying has not resolved the recurring problem, interrupting requests before completion." OpenAI has not published a cause as of 24 October 2026.

In short, the response stream closed before the model finished. This is a dropped connection, not "at capacity" and not your usage limit.

Quick fix: what to try right now

  1. Retry, or start a new turn. The error text itself says "You can retry your request". If one retry works, carry on.
  2. Read the text after the colon. It often names a more specific failure. Match it to a section below.
  3. Check status.openai.com. When we checked on 24 October 2026, it read "All Systems Operational", so a green page doesn't rule this error out.
  4. Resume, don't restart. If a long task stopped, pick it back up with codex resume (see the Codex CLI reference) so you keep its context.

Read the text after the colon

People search for several versions of this error, each with different text after the colon. OpenAI hasn't documented what each one means, so treat the notes below as places to look, not confirmed causes.

stream closed before response.completed

The stream ended before the final event arrived. If it keeps happening on one long chat, try a new chat or a smaller task, then resume.

idle timeout waiting for SSE or websocket

No data arrived for a while, so Codex gave up on the stream. Long-thinking turns and slow networks are worth checking first. See the timeout setting below.

error sending request for url or tls handshake eof

These point to the connection itself. A common pattern, not documented by OpenAI, is a VPN, proxy, or company network that inspects TLS traffic. If you can, try once on a different network to compare.

response.failed event received

The server reported that the response failed. That's usually not something your settings can change. Retry, check the status page, and file an issue with the request ID if it keeps happening.

Make Codex retry the stream on its own

The Codex config reference lists these per-provider settings:

  • model_providers.<id>.stream_max_retries: "Retry count for SSE streaming interruptions (default: 5)."
  • model_providers.<id>.stream_idle_timeout_ms: "Idle timeout for SSE streams in milliseconds (default: 300000)."
  • model_providers.<id>.request_max_retries: "Retry count for HTTP requests to the provider (default: 4)."

Put them in your user-level ~/.codex/config.toml. The same page says Codex ignores model_providers in a project-local .codex/config.toml: "put provider, notification, and telemetry keys in user-level config instead." Raising these may help with short blips. It's unlikely to help when the server itself fails the response.

It happens during remote compact

The error can also appear when Codex compacts a chat's context. In openai/codex #56164 (opened 22 Oct 2026), running /compact in the Windows desktop app failed with:

Error running remote compact task: stream disconnected before completion: stream closed before response.completed

That reporter had just switched models in an existing chat. If you see this, try compacting again, or start a new chat with a short handoff note (goal, what's done, what's next, files touched).

Keep long codex exec runs alive

For long or unattended runs, keep each step small and committed, so a dropped stream costs you one step, not the whole job. When a session stops, resume it with codex resume rather than starting fresh.

When to file an issue

If the error keeps coming back, file an issue on the Codex GitHub repo or contact OpenAI through help.openai.com. Include the request ID, as the error asks, plus your Codex version, platform, and the full text after the colon.

FAQ

Does it use up my Codex quota? We found no official answer as of 24 October 2026.

Is it the same as "at capacity"? No. "Stream disconnected" means the connection dropped before the answer finished. "At capacity" is a different message.

Is my VPN the cause? It might be, mainly for "tls handshake eof" or "error sending request". Compare once on another network before changing anything else.

Which config keys help? stream_max_retries, stream_idle_timeout_ms, and request_max_retries, set per provider in user-level config.

Why does it happen on the Windows desktop app? OpenAI hasn't said. #53777 is a Windows desktop report, but people search for this error with the CLI too.

What is the request ID for? The error asks you to include it when you contact OpenAI, so they can find your failed request.

Related: Codex credits, costs, and usage limit resets, ChatGPT Pro and Codex usage limits, the 429 rate limit guide, and other Codex desktop fixes.

Seeing "Selected model is at capacity" instead? That's a different error. See Codex “selected model is at capacity”.

Sources

Checked 24 Oct 2026: github.com/openai/codex issues #53777 and #56164; developers.openai.com/codex/config-reference; developers.openai.com/codex/cli/reference; status.openai.com.

OpenAI, ChatGPT, and Codex are trademarks of OpenAI. GitHub is a trademark of GitHub, Inc. Windows is a trademark of Microsoft Corporation. Other names belong to their owners. Names are used only to identify products and compatibility. Stack & Ship is not affiliated with or endorsed by any of them.