bug: codex doesn't recover from loss of connectivity
Resolved 💬 12 comments Opened Apr 25, 2025 by NickSdot Closed Aug 7, 2025
What version of Codex is running?
0.1.2504221401
Which model were you using?
o4-mini
What platform is your computer?
Darwin 24.3.0 arm64 arm
What steps can reproduce the bug?
It happens quite regulary that it is thinking for like 240 seconds and then fails with:
Connection closed prematurely while waiting for the model. Please try again.Network error while contacting OpenAI. Please check your connection and try again.
The errors point to connection issues. However, having a non-stable connection isn't a very rare situation for me. I would appreciate if situations like that would be handled a bit more graceful.
More retries? Loger waits? Not sure.
No VPN, nor proxy. #464 seems related. But the discussion goes more in the direction of a proxy, so I figured to open this one separately.
What is the expected behavior?
Either solve it alltogether, or make it easier to pick-up on previously failed sessions.
Additional information
Thanks for your hard work on Codex. Pretty cool thing!
12 Comments
I have been experiencing this bug too. It started about 20 hours ago, I have not been able to use Codex at all.
Update - my API key had been corrupted.
unset OPENAI_API_KEY
export OPENAI_API_KEY="YOURAPIKEYGOESHERE"
also important -- you need to make sure you are in the right tier (maybe we need some sort of "time between turns"), you will get a lot of failures if you hit RPM/TPM limits.
For me definitely only sporadically and without clear pattern. Key works fine in general.
Rate limit issue was afaik solved two days ago? The issue above for me only started today if I am not mistaken. I'd expect to get different error messages in that case, though.
--
If I can provide any other helpful info feel free to let me know how and what. Thanks!
I don't think this is actually a bug. More likely the server upstream is killing the connection early because of busy servers/saturation.
The issue isn't the loss of connectivity itself, but rather that Codex doesn't recover from it.
I'm also running into this (on macOS within a devcontainer running ubuntu).
thinking for 300s+ and then aborting with network error:
(model: codex-mini-latest)
Same here.
same here
This is frustrating and happens in every session past 3/4 interactions and making
codexpretty much unusable.same here
same here
Thank you for the feedback! Please try again on the latest version of Codex CLI to see if the issue persists. We're focusing on the native/Rust implementation of Codex CLI, which may offer improvements. If the problem continues, we welcome further input.