encouted 401 connection error
Resolved 💬 4 comments Opened Oct 26, 2025 by zorurume Closed Nov 15, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
OpenAI Codex (v0.50.0)
What subscription do you have?
chtgpt PRO
Which model were you using?
GPT5
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What issue are you seeing?
I encountered repeated 401 Unauthorized errors when trying to use the Codex command-line tool on Windows. I tried uninstalling and reinstalling Codex via npm, cleaning caches, and checking environment variables, but the issue persisted—sometimes the codex command wasn’t even recognized after installation. I’m wondering: could these authentication or command-path problems be related to the fact that I was experimenting with using Codex to call itself—essentially trying to build a multi-agent system by having one Codex instance control another?
What steps can reproduce the bug?
Uploaded thread: 019a1f4e-65f0-75f3-9ff6-92f451ed4de7
What is the expected behavior?
_No response_
Additional information
_No response_
4 Comments
Thanks for the bug report. We're actively investigating similar reports from other users. This could be an issue with token refresh. Try logging out (
codex logoutor/logoutslash command) and logging back in, and let us know if that fixes the issue for you.@etraut-openai thansk, I got same trouble and logout / login hepls for me.
But the client should not doing retries when the 401 code is received.
Based on the symptoms, this was likely an authentication token refresh issue. We've since added code to better handle this condition, so I'm going to close. If you see something similar with the latest versions of the CLI, please open a new bug report.