Codex Error: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
Resolved 💬 22 comments Opened Mar 6, 2026 by Supercox72 Closed Mar 9, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
■ stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
I started getting this at my office on Wednesday evening March 4, 2026 and regularly receiving them at my home since then Wednesday through Friday March 6, 2026.
<img width="640" height="1080" alt="Image" src="https://github.com/user-attachments/assets/860f9598-8190-4404-b018-9b8f12234367" />
22 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
same happen to me.
log out and log in again solve the issue for me.
I tried logging out and back in and it did not resolve the issue.
Token exchange failed: error sending request for url (https://auth.openai.com/oauth/token)
I took the bait... desperate to get this working again and then I can't get logged back in!
Five separate times (& counting) without luck!
<img width="1499" height="175" alt="Image" src="https://github.com/user-attachments/assets/a80cf391-f311-4076-9f55-0b938e6713c2" />
I've also noticed the following oddities:
Unable to upload files:
<img width="1013" height="664" alt="Image" src="https://github.com/user-attachments/assets/161bacd5-3cbe-4b98-ba6e-87e4f79fd8a6" />
I downloaded & installed the Codex App from the Microsoft Store. I am having connectivity issues with it as well:
<img width="960" height="1080" alt="Image" src="https://github.com/user-attachments/assets/69ba38f8-2f0f-4ee4-9ebf-0f1cd930d097" />
Sign-in could not be completed with Codex:
<img width="705" height="392" alt="Image" src="https://github.com/user-attachments/assets/6047789c-e8ed-4a80-be26-e3de6b2c1d94" />
This looks like a basic network connectivity issue. Are you using a VPN, proxy, firewall, or any other software that could affect networking? We find that's a common cause of connectivity issues like this.
I have the same - codex randomly stopped working today with error 'stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)'. Initially from Intellij, but then installed the codex CLI and the same happens. Not on a VPN. Have general connectivity for everything else so not buying the "basic network connectivity" excuse. Feels more like a bug your end tbh.
I was able to get it working with the help of ChatGPT...
Final Root Causes
I initially thought the same things, but then I dug into it with ChatGPT and was able to resolve my issues with my PC & Verizon internet router that I have in my residence.
It was a good idea getting chatgpt to help troubleshoot the problem. Unfortunately it's exhausted all options and is convinced this is a bug and I should report it. Where it will be ignored because it can't be reproduced. It's hard work isn't it? 😢
happens all day long every day, multple devices, multiple locations. connection is 1gbs, so clearly an openai gateway issue
Seeing this on every session
Oh I should have updated. Eventually ChtGPT blamed some drivers in ubuntu 20. A fresh install of Ubuntu 24 fixed the problem and not had any bother since.
i have meet this issue multiple times this days: submit an spec before sleep, but see this error on the morning. can you please add an auto retry policy.
@bnllb, we do have an auto retry policy. It retries up to five times with back-off. If it fails five times in a row, we consider it unrecoverable and stop.
Environment
/home/groverlee/.claude/plugins/cache/openai-codex/codex/1.0.3/gpt-5.4(withmodel_reasoning_effort = "xhigh"in~/.codex/config.toml, but also reproduces onmedium)codex-companion.mjs review --backgroundfrom Claude Code plugin wrapperWhat happens
/codex:reviewand/codex:rescueconsistently fail on one specific repository with the following pattern:After
Reviewer started: current changes, the stream stays at zero bytes of payload for 60-90 seconds, then enters the Reconnecting loop and eventually dies. No reasoning tokens, no output text — nothing is emitted.Scope of reproduction
On this one repository, across a single session (2026-04-19 night → 2026-04-20 morning):
| Attempts | Result |
| -------- | ----------------------------------- |
| 20 | 0 successful, 20 same-mode failures |
The same account (
groverpumc@gmail.com, ChatGPT OAuth) previously completed a full/codex:reviewcycle on a different, smaller repository (test_cc_code) earlier in the same evening, returning a 9-issue review→fix→verify loop in ~8 minutes. So the auth, binary, and network path work in general — the failure is bound to this particular repo or the repo's diff pattern.What I tried (eliminated as causes)
npm install -g @openai/codex): no change.codex logout→rm ~/.codex/auth.json→codex login: no change.model_reasoning_effort: testedxhighandmedium, both fail identically.OPENAI_API_KEY: not set (no conflict with ChatGPT OAuth).~/.codex/config.tomlhas no[mcp_servers.*]entries.experimental_use_rmcp_client: not set (default).Minimum reproduction
git inita repository.git add <file>so the working tree has a staged diff./codex:review --background(ornode codex-companion.mjs review --background).Request
If this is a known issue tracked under an existing ticket, please point me there and I'll add my logs as an additional datapoint. Otherwise, any diagnostic information you need (full session log, Codex session IDs, etc.) I can provide.
Related open issues that look similar: #13811, #13245, #8465, #14583.
same to me
same problem
same problem and with the lastest update the
`
Add the following configuration in ~/.codex/config.toml:
model_provider = "openai_http"
[model_providers.openai_http]
name = "OpenAI HTTP only"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = false
base_url = "https://chatgpt.com/backend-api/codex"`
approach stoped working too
Если вы с россии, то вот гайд как исправить это и пользоваться Codex в режиме proxy (tun)
<img width="497" height="496" alt="Image" src="https://github.com/user-attachments/assets/4b87e8a9-5cab-4d49-a78c-8f5656d44c66" />
<img width="827" height="525" alt="Image" src="https://github.com/user-attachments/assets/677aad87-fe76-4854-ad55-183c649e26ce" />
<img width="818" height="465" alt="Image" src="https://github.com/user-attachments/assets/9086db68-9e68-4317-8af9-73dbd939e483" />
Was able to get codex working again for me, in my case the DNS resolution in WSL instance was broken, you can confirm it with running this in your WSL machine:
If this says name or service not known and the following ping returns normal answer:
Then your issue is most likely in
Quickfix: set google DNS as nameserver. This should make codex work again and from that moment on you can tell him to find out why it happened in the first place. resolv.conf should look something like this then:
and curl to auth.openai.com should now work again.
== UPDATE ==
found the source of the problem, it seems to be an issue with stale HSN Firewall rules. I used the following commands, found under https://learn.microsoft.com/en-us/windows/wsl/troubleshooting under "Troubleshooting DNS in WSL" under point 4.:
(note this will remove firewall rules for port 53/udp, usually not a problem unless you have explicit custom setup there).
Then set DNS to local resolver and it my old setup before the quickfix (setting google dns), was working again as usual.
Fix: token_exchange_failed on login and stream disconnected before completion during use
Environment: Codex CLI 0.136.0 on macOS, using a local HTTP proxy (Clash-style).
Symptoms
Inconsistent proxy environment variables. My shell had the lowercase and uppercase proxy variables pointing to different ports:
https_proxy = http://127.0.0.1:7897 # correct (my real proxy port)
HTTPS_PROXY = http://127.0.0.1:7899 # WRONG port — nothing listening there
curl uses the lowercase https_proxy, so a manual curl https://auth.openai.com/oauth/token worked fine (returned an expected 405, proving the network path was OK). But Codex reads the uppercase HTTPS_PROXY, so it sent the OAuth token exchange (and later the streaming responses requests) to port 7899, where no proxy was listening — hence error sending request for url.
Fix
Make all proxy variables consistent and point to the actual proxy port:
export http_proxy="http://127.0.0.1:7897"
export https_proxy="http://127.0.0.1:7897"
export HTTP_PROXY="http://127.0.0.1:7897"
export HTTPS_PROXY="http://127.0.0.1:7897"
export ALL_PROXY="socks5://127.0.0.1:7897"
Update these in your shell profile (~/.zshrc / ~/.bashrc), then open a new terminal (or source the file) and launch Codex from that session.
Tip: Grep your profile to catch stale/duplicate proxy lines that override each other:
grep -rn -i "proxy" ~/.zshrc ~/.zprofile ~/.bashrc ~/.bash_profile
Note on the streaming error
The stream disconnected before completion error hits the SSE endpoint backend-api/codex/responses, which holds a long-lived streaming connection. If it persists even after the ports are consistent, the proxy itself is likely dropping long connections. Things that helped:
---
Want me to shorten it into a comment-sized version, or format it as a full issue with a title?
token_exchange_failed
Token exchange failed: error sending request for url (https://auth.openai.com/oauth/token)
stream disconnected before completion: error sending request for url
(https://chatgpt.com/backend-api/codex/responses)
Root cause
Inconsistent proxy environment variables. My shell had the lowercase and uppercase proxy variables pointing to different ports:
https_proxy = http://127.0.0.1:7897 # correct (my real proxy port)
HTTPS_PROXY = http://127.0.0.1:7899 # WRONG port — nothing listening there
curl uses the lowercase https_proxy, so a manual curl https://auth.openai.com/oauth/token worked fine (returned an expected 405, proving the network path was OK). But Codex reads the uppercase HTTPS_PROXY, so it sent the OAuth token exchange (and later the streaming responses requests) to port 7899, where no proxy was listening — hence error sending request for url.
Fix
Make all proxy variables consistent and point to the actual proxy port:
export http_proxy="http://127.0.0.1:7897"
export https_proxy="http://127.0.0.1:7897"
export HTTP_PROXY="http://127.0.0.1:7897"
export HTTPS_PROXY="http://127.0.0.1:7897"
export ALL_PROXY="socks5://127.0.0.1:7897"
Update these in your shell profile (~/.zshrc / ~/.bashrc), then open a new terminal (or source the file) and launch Codex from that session.
Tip: Grep your profile to catch stale/duplicate proxy lines that override each other:
grep -rn -i "proxy" ~/.zshrc ~/.zprofile ~/.bashrc ~/.bash_profile