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!

View original on GitHub ↗

12 Comments

tomdread · 1 year ago

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"

eric-humane · 1 year ago

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.

NickSdot · 1 year ago
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!

josephbartlett · 1 year ago

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

thingersoft · 1 year ago
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.

tosh · 1 year ago

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)

joaqo · 1 year ago

Same here.

filipehdbr · 1 year ago

same here

msmans · 1 year ago

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
inagumanov · 1 year ago

same here

emerzon · 1 year ago

same here

codex-maintainers · 11 months ago

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.