codex - 💡(How to fix) Fix Codex CLI waits ~30 minutes with ERROR: Reconnecting... before reporting image generation rejection

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

ERROR: Reconnecting... 2/5 ERROR: Reconnecting... 3/5 ERROR: Reconnecting... 4/5 ERROR: Reconnecting... 5/5 ERROR: Reconnecting... 2/5 ERROR: Reconnecting... 3/5 ERROR: Reconnecting... 4/5 ERROR: Reconnecting... 5/5 If image generation is rejected or fails, Codex CLI should fail fast and report the error immediately.

RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.130.0

What subscription do you have?

ChatGPT Plus

Which model were you using?

gpt-5.5 medium

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What terminal emulator and version are you using (if applicable)?

VS Code

Codex doctor report

What issue are you seeing?

When image generation is rejected by the image generation tool, Codex CLI does not fail immediately.

Instead, it repeatedly shows reconnect messages such as:

ERROR: Reconnecting... 2/5 ERROR: Reconnecting... 3/5 ERROR: Reconnecting... 4/5 ERROR: Reconnecting... 5/5

This reconnect loop continues for around 30 minutes before Codex finally responds that the image generation failed or was rejected.

Example of the final response:

The initial image generation tool call failed. The detailed reason was not returned, so I adjusted the prompt and retried.

Interestingly, this long reconnect wait seems to happen mainly on the first image generation attempt in a request.

After the first attempt, if later image generations are rejected in the same request/session, Codex usually returns the rejection immediately without the long reconnect delay.

What steps can reproduce the bug?

  1. Run Codex CLI using codex exec
  2. Request image generation
  3. Trigger a case where the image generation tool rejects or fails
  4. Observe the reconnect loop

Example:

codex exec "Generate an anime-style female warrior character"

Observed behavior:

ERROR: Reconnecting... 2/5 ERROR: Reconnecting... 3/5 ERROR: Reconnecting... 4/5 ERROR: Reconnecting... 5/5

Codex then waits for around 30 minutes before finally reporting the image generation rejection/failure.

What is the expected behavior?

If image generation is rejected or fails, Codex CLI should fail fast and report the error immediately.

The CLI should not spend around 30 minutes retrying reconnects before returning the rejection result.

Ideally there should also be:

  • a configurable reconnect timeout
  • a fail-fast mode for codex exec
  • an option to disable long reconnect retries for non-interactive batch usage

Additional information

  • ChatGPT web UI image generation returns rejection/failure much faster in the same environment
  • The issue appears related to reconnect handling after image generation tool failure
  • The first failure in a request/session is much slower than subsequent failures

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING