codex icon indicating copy to clipboard operation
codex copied to clipboard

bug: codex doesn't recover from loss of connectivity

Open NickSdot opened this issue 1 year ago • 12 comments

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!

NickSdot avatar Apr 25 '25 10:04 NickSdot

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"

tomdread avatar Apr 25 '25 16:04 tomdread

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.

eric-humane avatar Apr 25 '25 18:04 eric-humane

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.

For me definitely only sporadically and without clear pattern. Key works fine in general.

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.

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!

NickSdot avatar Apr 25 '25 19:04 NickSdot

I don't think this is actually a bug. More likely the server upstream is killing the connection early because of busy servers/saturation.

josephbartlett avatar May 07 '25 15:05 josephbartlett

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.

thingersoft avatar May 14 '25 02:05 thingersoft

I'm also running into this (on macOS within a devcontainer running ubuntu).

thinking for 300s+ and then aborting with network error:

⚠️ Network error while contacting OpenAI. Please check your connection and try again.

(model: codex-mini-latest)

tosh avatar May 17 '25 11:05 tosh

Same here.

joaqo avatar May 21 '25 21:05 joaqo

same here

filipehdbr avatar May 22 '25 00:05 filipehdbr

This is frustrating and happens in every session past 3/4 interactions and making codex pretty much unusable.

    system
    ⚠️  Network error while contacting OpenAI. Please check your connection and try again.
$ codex --version
0.1.2505172129
model: codex-mini-latest
$ sw_vers
ProductName:		macOS
ProductVersion:		15.5
BuildVersion:		24F74
$ uname -m
arm64

msmans avatar May 23 '25 05:05 msmans

same here

inagumanov avatar May 26 '25 07:05 inagumanov

same here

emerzon avatar Jul 16 '25 14:07 emerzon

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.

codex-maintainers avatar Aug 07 '25 18:08 codex-maintainers