Repository navigation
Description
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:
■ 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:
■ exceeded retry limit, last status: 401 Unauthorized
What do you see instead?
No response
Additional information
No response
Activity
maxiedaniels commentedon Sep 28, 2025
I fixed this yesterday by logging out and back in on Codex, but its happening today suddenly again. Surely this is a bug?
codedevmk commentedon Sep 28, 2025
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
CryptoScient commentedon Sep 28, 2025
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
Bl4ckh34d commentedon Oct 4, 2025
Same problem here but no solution so far.
scottjs commentedon Oct 8, 2025
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.
mahmutsalman commentedon Oct 13, 2025
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.
naillizard commentedon Oct 16, 2025
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!
naillizard commentedon Oct 16, 2025
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
etraut-openai commentedon Nov 12, 2025
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.