Stream error
What version of Codex is running?
codex-cli 0.42.0
Which model were you using?
gpt-5-codex-high
What platform is your computer?
Darwin 24.2.0 arm64 arm
What steps can reproduce the bug?
Simply type anything into the CLI
Example:
1, start codex: codex
2, type anything: hi
3, Bug occurs:
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 1/5 in 199ms…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 2/5 in 432ms…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 3/5 in 824ms…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 4/5 in 1.629s…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 5/5 in 3.166s…
■ exceeded retry limit, last status: 401 Unauthorized
What is the expected behavior?
Simply type anything into the CLI
Example:
1, start codex: codex
2, type anything: hi
3, Bug occurs:
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 1/5 in 199ms…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 2/5 in 432ms…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 3/5 in 824ms…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 4/5 in 1.629s…
⚠️ stream error: exceeded retry limit, last status: 401 Unauthorized; retrying 5/5 in 3.166s…
■ exceeded retry limit, last status: 401 Unauthorized
What do you see instead?
_No response_
Additional information
_No response_
9 Comments
I fixed this yesterday by logging out and back in on Codex, but its happening today suddenly again. Surely this is a bug?
same issue, yet when I check my context rate it clearly shows near zero usage.
5h limit. 0% used · resets 11:13 PM
Weekly limit. 10% used · resets Oct 1
I have tried everything in the past week to make this work but still get 401 errors. Only direct responces API works:
What we’ve checked so far:
• Headers policy: true none (no OpenAI-Project/OpenAI-Organization), project-only, project+org, and org-only. ✔️
• Config hygiene: API‑key mode, wire_api="responses", correct TOML mapping. ✔️
• CLI versions: 0.40.0 → 0.43.0‑alpha.2, each pinned with npx. ✔️
• Base URLs: both root and v1 variants to detect path vs. auth issues. ✔️
• Controls: direct Responses API (sync + SSE) succeed. ✔️
This is exactly the right isolation sequence. It shows the problem is specific to the CLI’s streaming endpoint authorization, not key or project.
If anyone finds the solution please let me know
Same problem here but no solution so far.
I was having this issue when trying to wire this up with a github action, this I had to run codex login first by piping the API key.
This is how I've fixed it:
This was originally inspired by: https://cookbook.openai.com/examples/codex/jira-github
If you're just trying to use your standard ChatGPT account (and not use the API) the resetting your local env and re-logging in also seems to help.
I am having the same issue, too. Although I haven't used it and I have a usage limit, this error still occurs. After i log out and log in again it resolved for now.
I'm having this issue also, if I login with chatgpt plus it just works, I then logout from chatgpt and use an apikey from openai with full access and I start getting these errors:
Funny thing is, using opencode with the gpt-5-codex works!
<img width="607" height="295" alt="Image" src="https://github.com/user-attachments/assets/baa6628d-8d81-48ac-b72d-df84a9181fa0" />
never mind, I resolved it, missed an important step
codex --config preferred_auth_method="apikey"https://developers.openai.com/codex/pricing#use-your-api-key-with-codex-cli
This was a problem with token refresh. It has been fixed in more recent versions, so I'm going to close this issue. If you're seeing other stream errors with the latest version of codex, please open a new issue.