OpenAI Codex CLI error
Codex CLI: stream disconnected before completion: error sending request for url...
stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)Status: OpenLast verified 3 documented fixes3 sources
What it means
Codex could not send the request to the Codex responses endpoint at all, so it shows "Reconnecting" and fails after its retry attempts.
Causes
- A contributor on #13245: from uploaded logs this looks like a basic network connectivity issue; seen frequently with VPNs and proxies, or simple connection flakiness.
- A contributor also asked users without a VPN whether a corporate proxy or firewall was in the path (#13245).
How to fix it
- Fix 1.
Check VPNs, proxies, corporate proxies and firewalls between your machine and chatgpt.com (a contributor on #13245).
- Fix 2.
If your network uses a corporate TLS proxy or private root CA, point Codex at the PEM bundle; the same CA settings apply to login, normal HTTPS requests and secure WebSocket connections (official auth docs).
Terminalexport CODEX_CA_CERTIFICATE=/path/to/corporate-root-ca.pem - Fix 3.
If it persists, run /feedback to send logs to the Codex maintainers (official slash command docs).
Slash command/feedback
More Codex CLI errors
All 14 Codex CLI errorsstream disconnected before completion: stream closed before response.completedStatus: WorkaroundError running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)Status: Fixed in releaseSelected model is at capacity. Please try a different model.Status: By designYour access token could not be refreshed because your refresh token was already used. Please log out and sign in again.Status: Fixed in releaseCodex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.Status: Fixed in releaseError logging in: Port 127.0.0.1:1455 is already in useStatus: WorkaroundToken exchange failed: token endpoint returned status 403 ForbiddenStatus: WorkaroundMCP client for `playwright` failed to start: program not foundStatus: Fixed in release
Related reading
- Droid vs Codex (2026): Factory vs OpenAI for Terminal Coding AgentsFactory Droid vs OpenAI Codex compared on models, pricing, headless CI, multi-agent work, extensibility and openness, with a clear recommendation for each kind of developer.
- Codex CLI 0.171: codex exec --remote, Workspace On by DefaultCodex CLI 0.171.0 adds codex exec --remote to run headless sessions on an existing app server, turns on the TUI workspace by default and picks GPT-6.2 Sol.
- GPT-6.2 Astra and Sol: Pricing, Benchmarks and What to SwitchGPT-6.2 Astra costs $8/$40 per MTok (20% under GPT-6 Astra), Sol stays $2/$10. Vendor-reported benchmarks, cache rates, Codex setup and who should switch.
- Codex CLI 0.169: codex exec Trust, Side Chats and Model ProvidersCodex CLI 0.169.0 keeps project config and MCP servers off in untrusted directories under codex exec, adds --trust, side-chat tabs and a model provider picker.
- Codex Training Setting Re-Enabled? Two Switches to CheckDevelopers report Codex model training turning itself back on. What OpenAI documents, the second "Include environments" switch most people miss, and a five-minute check.
- OpenAI Pando: The Git Backend Built for Codex-Scale PushesOpenAI built Pando, a Git-compatible backend, after Codex flooded its monorepo with pushes. What it changed, the trade-offs, and what it means for your agent fleet.
FAQ
What does "stream disconnected before completion: error sending request for url..." mean in Codex CLI?
Codex could not send the request to the Codex responses endpoint at all, so it shows "Reconnecting" and fails after its retry attempts.
How do I fix "stream disconnected before completion: error sending request for url..."?
There are 3 documented fixes. Start with the first: Check VPNs, proxies, corporate proxies and firewalls between your machine and chatgpt.com (a contributor on #13245).
Is this Codex CLI error fixed?
Status: Open. Still open upstream. Any documented fixes are workarounds so far. Affected versions: Reported March 2026 (#13245); no version-specific fix announced
Sources
Last verified against 3 sources: official docs, maintainer replies and release notes.
- github.comhttps://github.com/openai/codex/issues/13245
- learn.chatgpt.comhttps://learn.chatgpt.com/docs/auth
- learn.chatgpt.comhttps://learn.chatgpt.com/docs/developer-commands
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.