top of page

Codex keeps reconnecting and stops with "stream disconnected before completion": every cause and fix

2 hours ago
9 min read
Codex keeps reconnecting and stops with stream disconnected before completion, causes and fixes, with the OpenAI logo. Data Studios original cover

Last verified: November 11, 2026


When Codex shows "Reconnecting... 1/5", counts up to 5/5 and then gives up with "stream disconnected before completion", the connection that carries the model's answer back to your computer was cut before the reply finished. The task itself may have run partly, but Codex never received the end of the response, so the turn stops. The same message appears in the Codex desktop app, the VS Code extension and the command-line tool, and it has been reported again and again on the official Codex GitHub issue tracker through October and November 2026.


In many reports the fault sits between your machine and OpenAI, and the first fix is checking the network path and retrying once it is stable: a corporate firewall, a VPN, a proxy that inspects encrypted traffic or a laptop going to sleep can all break the stream. An OpenAI engineer answering one of these reports called it a basic network connectivity issue and asked the user to make sure the Codex endpoint was reachable. Other cases come from OpenAI's side, as during the disconnects reported on November 1 to 3, and those can only be waited out. ChatGPT Plus, Pro and Business subscribers have all reported it, on Windows, macOS and Linux.


··········


⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣

THE CODEX "STREAM DISCONNECTED BEFORE COMPLETION" MESSAGE AND ITS VARIANTS.


Codex streams every answer piece by piece instead of sending it in one block. A stream, in this sense, is a connection that stays open while the model writes. If that connection closes early, Codex retries the request several times, showing a counter in the interface, and prints the error only when the retries run out. Five is also the documented default for stream retries in the Codex configuration reference, which matches the 1/5 to 5/5 counter users see.


The words after the colon come from the layer that failed, and they are the part to copy when you search for help or file a report.


........


Text after "stream disconnected before completion:"

Where users report it

What it points to

error sending request for url (https://chatgpt.com/backend-api/codex/responses)

Desktop app, CLI, VS Code extension

The request never reached OpenAI or the connection dropped mid-way: network, proxy, VPN, DNS or an OpenAI incident

tls handshake eof

CLI in a Linux container on macOS

The secure connection could not be set up, often a proxy or firewall that intercepts encrypted traffic

idle timeout waiting for websocket

CLI on Windows and Linux

The open connection went silent until a timeout fired

Transport error: error decoding response body

CLI on Linux (2025 reports)

The answer arrived broken or cut short; OpenAI fixed an older version of this bug in September 2025

An error occurred while processing your request (with a request ID)

Windows desktop app

The server returned an error; the message itself asks you to retry or contact support with the request ID

Error running remote compact task: stream disconnected before completion

Desktop app and cloud tasks

The disconnect happened while Codex was compacting a long conversation to save context


........


Some users also see "Falling back from WebSockets to HTTPS transport" just before the error. WebSockets is a type of long-lived connection Codex uses for responses; when it fails, Codex tries ordinary HTTPS instead, and the error appears if that path fails too.


··········


WHY CODEX LOSES THE STREAM: CAUSES, CHECKS AND FIXES.


The causes below combine what OpenAI staff have said in replies on the Codex issue tracker, what the official Codex documentation describes, and what several users have reported. The last column says which is which when the fix is not documented.


........


Cause

How to check

Fix

Firewall, proxy or security software blocks or inspects the Codex endpoint

Codex works on another network (home, phone hotspot) but fails at work

Ask IT to allow https://chatgpt.com/backend-api/codex/responses, as an OpenAI engineer advised; point Codex at the company's root certificate (see below)

VPN or unstable Wi-Fi drops the long connection

Failures stop when the VPN is off or on a wired connection

Run long tasks on a stable connection; split work into shorter turns

Laptop sleep or lid closed during a task

Failures line up with the machine sleeping

Keep the machine awake while Codex works (from a user report; no official fix listed)

Outdated Codex version

Compare your version with the latest release in the app's update check or your package manager

Update; OpenAI closed a 2025 stream-cutoff bug as fixed in newer versions

Custom provider or third-party tool rewrote config.toml

config.toml contains a model_provider or model_providers block you did not add

Remove the conflicting provider; one user fixed the error this way after a provider-switching tool edited the file

OpenAI-side incident or capacity problem

The status page shows a Codex incident, or many users report it at the same hour

Wait, then retry; send feedback with the session ID


........


The office-only pattern is the strongest clue: in one closed report the user found that Codex failed at home but never at the office, and closed the issue after concluding the problem was on their side of the connection.


··········


FIXING CODEX DISCONNECTS ON A CORPORATE NETWORK, VPN OR PROXY.


Work networks come up again and again in these reports, because many of them inspect encrypted traffic. Inspection means a company proxy opens the secure connection, reads it and re-encrypts it with the company's own certificate. Codex then sees a certificate it does not trust, or the proxy cuts long-lived connections that look idle.


1. Try a different network first. A phone hotspot or home connection is enough to tell a network problem from an account or service problem.


2. If Codex works elsewhere, send your IT team the endpoint https://chatgpt.com/backend-api/codex/responses. An OpenAI engineer asked a Business user to do exactly this when the same error appeared on a Windows machine.


3. Ask IT whether the proxy performs TLS inspection, and ask for the company root certificate as a PEM file (a text file that begins with "BEGIN CERTIFICATE").


4. Tell Codex to trust that certificate. Codex reads the CODEX_CA_CERTIFICATE environment variable first, falls back to SSL_CERT_FILE, and otherwise uses the system's certificate store, according to the change that added this behavior to the official Codex repository. The same setting covers both the HTTPS and the WebSocket connections.


5. Turn the VPN off for a test run. If the error disappears, ask whether the VPN can exclude chatgpt.com or keep idle connections open longer.


6. Check DNS. OpenAI staff listed DNS alongside firewalls, proxies and VPNs as things to rule out; a corporate DNS filter that blocks or redirects chatgpt.com can produce the same "error sending request" text.


The lines below are an illustrative example for macOS or Linux shells, not text from OpenAI's documentation. The path is a placeholder for the certificate file your IT team gives you.


# illustrative: point Codex at your company's root certificate (PEM)
export CODEX_CA_CERTIFICATE=/path/to/company-root-ca.pem
codex

On Windows, set the same variable in System Properties under Environment Variables, then restart the Codex app or terminal so it picks up the change. The Codex configuration reference pages do not list CODEX_CA_CERTIFICATE, so treat it as a source-level setting that may change between versions.


··········


TUNING CODEX RETRIES AND TIMEOUTS FOR CUSTOM PROVIDERS.


Codex has three settings that control how often it retries and how long it waits for a silent stream. They live in config.toml, the Codex configuration file stored in the Codex home folder (by default ~/.codex), and they apply per model provider.


........


config.toml key

What it controls

Documented default

request_max_retries

Retries for HTTP requests to the provider

4

stream_max_retries

Retries when a streamed answer is interrupted

5

stream_idle_timeout_ms

How long a silent stream may stay idle before Codex gives up

300000 (5 minutes)


........


These settings have a limit. The configuration reference states that the built-in provider IDs openai, ollama and lmstudio are reserved and cannot be overridden. Raising these numbers therefore helps only when you connect Codex through your own provider block, such as Azure OpenAI or a company LLM proxy. If you sign in with your ChatGPT account and use the default provider, these keys are not the fix.


For a custom provider, OpenAI's advanced configuration page shows the keys inside the provider block. This is the official Azure example:


[model_providers.azure]
name = "Azure"
base_url = "https://YOUR_PROJECT_NAME.openai.azure.com/openai"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { api-version = "2025-04-01-preview" }
wire_api = "responses"
request_max_retries = 4
stream_max_retries = 10
stream_idle_timeout_ms = 300000

One Azure user on the issue tracker reported that raising these values "mostly" stopped the disconnects. That is a single report, and OpenAI has not documented it as a fix for the error.


··········


[[ADPLUS_300x250_1]]

WHEN THE CODEX DISCONNECTS COME FROM OPENAI'S SIDE.


Some waves of this error have nothing to do with the user's network. Between October 10 and 13, 2026, several Windows users of the Codex desktop app (version 26.1007.21434 and nearby builds) opened separate reports of repeated "Reconnecting 5/5" failures that persisted after restarts and network changes. In early November another report described parallel Codex sessions failing from November 1 to 3 with "workspace routing discovery timed out" alongside the stream disconnect, while other sessions kept working. Neither thread has an OpenAI reply naming a cause, and both remain open.


The OpenAI status page lists Codex as its own group, with separate components for Codex Web, the Codex API, the CLI and the VS Code extension. Checking it is the fastest way to know whether to keep debugging your network.


1. Open the OpenAI status page and look at the Codex components before changing anything on your machine.


2. If there is an incident, pause long tasks until the status page shows it resolved.


3. When the error includes a request ID, keep it. The error text itself asks you to include that ID if you contact OpenAI support.


4. Send feedback from Codex. The official troubleshooting page says that typing "/" in the composer opens the feedback option and that you receive a session ID to share with the team; OpenAI staff asked users with this error to run /feedback and post that ID.


5. After the incident, check what finished. Codex keeps session transcripts in the sessions folder of the Codex home folder (by default ~/.codex/sessions), which shows the last step that ran before the disconnect.


An interrupted turn does not say whether files were written or commits made, as the November reporter noted, so review the working tree before telling Codex to continue.


··········


CODEX DESKTOP APP, VS CODE EXTENSION AND CLI: PLATFORM DIFFERENCES.


The error is the same across the three Codex surfaces, but logs and settings sit in different places. The table lists only locations stated in the official Codex documentation.


........


Codex surface

Where to look

Notes

Desktop app on macOS

~/Library/Logs/com.openai.codex/YYYY/MM/DD

App logs path given on the official troubleshooting page

CLI (any system)

$CODEX_HOME/log (default ~/.codex/log)

Set by the log_dir key; sessions in ~/.codex/sessions

Desktop app on Windows

No log path documented

Several October 2026 disconnect reports came from this app; use /feedback

VS Code extension

No separate log path documented

One Windows user found the extension also disconnected after switching from the app


........


The official troubleshooting page has no entry for this error on Windows, where users report that restarts did not help. It does advise waiting for active chats to complete and then restarting the app when Codex stays stuck.


··········


⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁤

WHAT OPENAI HAS DOCUMENTED AND WHAT ONLY USERS REPORT ABOUT CODEX DISCONNECTS.


OpenAI has no help-center article or documentation page for "stream disconnected before completion". What it has published is spread across staff replies, the configuration reference and the troubleshooting page.


........


Statement

Status

Retry and idle-timeout keys exist, with defaults 4, 5 and 300000 ms

Documented in the configuration reference

Built-in providers (openai, ollama, lmstudio) cannot be overridden

Documented in the configuration reference

The error usually reflects a network connectivity problem; allow the Codex endpoint

OpenAI staff reply on the Codex issue tracker

A 2025 bug that cut streams at about 150 seconds is fixed in newer versions

OpenAI staff reply, September 2025

CODEX_CA_CERTIFICATE and SSL_CERT_FILE are honored for HTTPS and WebSocket connections

Official repository change; absent from the reference pages

Laptop sleep breaks running tasks

User report on the issue tracker; no fix announced

Raising retry values reduces disconnects

One user report, Azure provider only

October and early November 2026 waves were server-side

User reports with no OpenAI explanation; issues still open


........


··········


KEEPING LONG CODEX TASKS ALIVE AFTER UPDATES.


Long agent runs are especially exposed, because they hold a connection open for minutes and often pass through compaction. A few habits reduce the damage. Break big jobs into stages that each end with a commit, so a disconnect costs one stage. Keep the computer awake and on one network for the length of the task. After each Codex update, run one short task before starting a long one, since several October reports came from the same desktop app build.


If you configure Codex through a provider-switching tool or a company proxy, re-read config.toml after updates and after installing such tools, and remove provider blocks you no longer use. When disconnects come with a "Selected model is at capacity" message instead, the problem is model availability, which has its own causes and fixes in our article on the Codex "Selected model is at capacity" error. For the models Codex currently offers, see our guide to Codex models in 2026, and for plan caps, including the shared Codex pool coming in December, see our guide to ChatGPT usage limits.


··········


CODEX STREAM DISCONNECTS: WHAT TO TRY FIRST.


The fastest test is a second network. If Codex works on a phone hotspot, the cause is your firewall, VPN, proxy or DNS, and the fix is allowing the Codex endpoint and, behind TLS inspection, giving Codex the company root certificate through CODEX_CA_CERTIFICATE. If it fails everywhere, check the OpenAI status page and the open GitHub reports for the same hour, then wait instead of restarting long tasks.


The retry settings often suggested for this error change nothing for the default ChatGPT sign-in, because the built-in openai provider cannot be overridden; they help only on Azure or a custom proxy provider. Updating Codex remains a sound step, since OpenAI has fixed one version of this error before, but the October and November 2026 reports on Windows and parallel sessions still have no published cause, and the request ID and session ID are what OpenAI needs to trace them.


··········


FOLLOW US FOR MORE.


·····


DATA STUDIOS


·····


datastudios.org


bottom of page