Repository navigation
Description
What version of the Codex App are you using (From “About Codex” dialog)?
penAI.Codex_26.818.8289.0_x64
What subscription do you have?
Pro
What platform is your computer?
Windows 11 - 10.0.26200.9168
What issue are you seeing?
Codex Desktop on Windows repeatedly failed with:
Reconnecting /5
stream disconnected before completion: No connection could be made because the target machine actively refused it. (os error 10061)
Reconnecting... waiting for network
Connection failed: error sending request
The failure was caused by a stale custom base URL in %USERPROFILE%.codex\config.toml:
openai_base_url = "http://127.0.0.1:8787/v1"
Nothing was listening on 127.0.0.1:8787, but Codex continued trying to connect to it. The UI only reported a generic network/reconnect error and did not indicate that the failing connection was the configured openai_base_url.
Removing the openai_base_url override and restarting Codex immediately restored normal operation.
What steps can reproduce the bug?
On Windows 11:
- Add the following to %USERPROFILE%.codex\config.toml:
openai_base_url = "http://127.0.0.1:8787/v1" - Make sure no process is listening on TCP port 8787.
- Start/restart Codex Desktop.
- Send any prompt.
- Codex begins reconnecting and eventually reports:
stream disconnected before completion: No connection could be made because the target machine actively refused it. (os error 10061) - Find the Codex process PID and inspect its connections:
tasklist | findstr /I codex
netstat -ano | findstr <CODEX_PID>
During the failure I observed:
TCP 127.0.0.1:<ephemeral-port> 127.0.0.1:8787 SYN_SENT
TCP <local-ip>:<ephemeral-port> 104.18.32.47:443 ESTABLISHED
I also verified that the normal Codex backend was reachable independently:
curl.exe -i -X POST https://chatgpt.com/backend-api/codex/responses
This returned:
HTTP/1.1 401 Unauthorized
{"detail":"Unauthorized"}
The 401 is expected without authentication and confirmed that DNS, TCP, TLS, and connectivity to the normal Codex backend were working.
I also confirmed there was no Windows proxy involved:
netsh winhttp show proxy
Result:
Direct access (no proxy server).
And:
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable
Result:
ProxyEnable REG_DWORD 0x0
Finally, I removed:
openai_base_url = "http://127.0.0.1:8787/v1"
from config.toml, restarted Codex Desktop, and prompts immediately worked again.
Codex Desktop package observed during testing:
OpenAI.Codex_26.818.8289.0_x64
Windows build:
10.0.26200.9168
What is the expected behavior?
If a non-default openai_base_url is configured and that endpoint refuses the connection, Codex should surface that information in the error.
For example:
Unable to connect to configured OpenAI base URL:
http://127.0.0.1:8787/v1
The endpoint refused the connection. Check your openai_base_url setting in config.toml or verify that the local proxy/service is running.
Codex should not present only a generic network/reconnection error when it already knows that requests are being routed to a user-configured custom endpoint.
This would make it clear that general internet connectivity, authentication, firewall, or the OpenAI service itself may not be the problem.
Additional information
The stale openai_base_url appears to have originated from a third-party local proxy integration. I am not claiming Codex created the stale configuration.
The Codex-side issue is that the current error does not identify the actual failing destination, which makes a straightforward local endpoint failure look like a general Codex/OpenAI network outage.
The diagnostic evidence was fairly clear:
Codex -> 127.0.0.1:8787 SYN_SENT / failing
Codex -> remote :443 ESTABLISHED
while the normal chatgpt.com/backend-api/codex/responses endpoint remained reachable.
A more specific error for unreachable custom openai_base_url configurations would significantly reduce troubleshooting time
Activity
SalehAhmed10 commentedon Aug 31, 2026
Windows ChatGPT / Codex app: same 10061, different leftover port
Hit this on the ChatGPT / Codex desktop app (Windows):
A full quit + reopen of the app did not fix it.
Root cause
%USERPROFILE%\.codex\config.tomlhad a stale local override:Nothing was listening on
127.0.0.1:17841(confirmed withGet-NetTCPConnection). Codex kept sending the stream there, so Windows returned 10061. The UI only said “waiting for network”, which made it look like an OpenAI outage.Checks that were fine:
chatgpt.com:443reachableGET https://chatgpt.com/backend-api/codex/responsesreturned 405 (endpoint alive)%USERPROFILE%\.codex\.envFix
Comment out the line:
# openai_base_url = "http://127.0.0.1:17841/v1"Fully quit ChatGPT (end all
ChatGPTprocesses), reopen, start a new Codex chat. Streams worked again.This matches this issue: connection-refused to a dead
openai_base_url. Here the leftover port was 17841, not 8787. Restarting the app never brought the local helper back.If the UI named the refused destination (
127.0.0.1:17841/ configuredopenai_base_url) instead of “waiting for network”, this would have been obvious.jianggabi4-bot commentedon Sep 5, 2026
Superseded by the final consolidated report and recovery guide below: #40435 (comment)
jianggabi4-bot commentedon Sep 5, 2026
Superseded by the final consolidated report and recovery guide below: #40435 (comment)
jianggabi4-bot commentedon Sep 5, 2026
Final consolidated Windows recovery + prevention summary from this case:
User impact
The stale custom
openai_base_urlcaused 3–4 days of unusable Codex Desktop. The misleading UI (Reconnecting... waiting for network/Connection failed: error sending request) led to repeated troubleshooting of Wi‑Fi, VPN, TLS, Cloudflare, and OpenAI availability even though general OpenAI connectivity was healthy.Root cause
A third-party OpenCodex integration had previously injected:
into
%USERPROFILE%\.codex\config.toml.That loopback proxy later stopped / failed to autostart, but the override remained. Codex Desktop therefore kept routing model requests to a dead localhost endpoint.
Successful recovery
OpenCodex cleanup / safer configuration
The machine also had a partially broken OpenCodex lifecycle setup:
codexAutoStart: enabledTo make official Codex the safe default while preserving third-party models as an on-demand fallback:
~/.opencodex/config.json:\opencodex-proxy, confirm with:and remove it from an elevated Command Prompt:
Recommended dual-mode workflow
Normal/default mode — official Codex
codexAutoStartdisabled.config.tomlshould contain noopenai_base_urloverride.Safety check:
No output = native Codex routing.
Fallback mode — third-party models via OpenCodex
When official Codex quota is exhausted:
ocx start ocx statusConfirm the proxy is healthy, then launch Codex and use the configured third-party model (e.g. Anthropic/Kimi/etc.).
Return to official Codex
Exit Codex, then:
or explicitly:
Then run the safety check again to ensure no localhost
openai_base_urlremains.Product improvement request
Codex Desktop should surface the actual failing destination whenever a non-default
openai_base_urlis configured. For loopback targets (127.0.0.1/localhost), an error like this would have prevented days of wasted troubleshooting:This case also shows that generic
waiting for networkwording is too broad when the app already knows requests are being routed to a user-configured localhost endpoint.0chanu commentedon Sep 13, 2026
Additional reproduction detail: an additive custom model-picker setup can unintentionally make Codex depend globally on a localhost
openai_base_url. If that local endpoint is down, even official OpenAI models fail with Windowsos error 10061, so a change intended only to add one provider can make the entire app unusable.Suggested safeguards:
openai_base_urlendpoints before use.This would make custom model catalogs genuinely additive and reduce the risk of a stale local proxy breaking all Codex model access.