Codex CLI waits ~30 minutes with ERROR: Reconnecting... before reporting image generation rejection
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?
- Run Codex CLI using
codex exec - Request image generation
- Trigger a case where the image generation tool rejects or fails
- 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
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗