OpenAI Codex CLI error
Codex CLI: Your access token could not be refreshed because your refresh token was...
Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.Status: Fixed in releaseLast verified 2 documented fixes4 sources
What it means
Codex tried to refresh your ChatGPT sign-in, but the refresh token had already been consumed, so the session cannot authenticate until you sign in again. Current source also has a separate message for an account change: "Your access token could not be refreshed because you have since logged out or signed in to another account. Please sign in again."
Causes
- A contributor on #9634: an older copy of Codex (CLI or IDE extension) left running in the background can cause this.
- A hole in token refresh logic for the app server used by the IDE extension, fixed in PR #11802.
How to fix it
- Fix 1.
Update Codex. A contributor said they think this is fixed in 0.117.0 and that significantly more logging was added; PR #11802 (Fixed a hole in token refresh logic for app server) first shipped in 0.105.0.
- Fix 2.
Log out and sign in again, as the message says, and close older Codex CLI or extension processes that may still be running.
Terminalcodex logout codex login
More Codex CLI errors
All 14 Codex CLI errorsstream disconnected before completion: stream closed before response.completedStatus: Workaroundstream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)Status: OpenError running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)Status: Fixed in releaseSelected model is at capacity. Please try a different model.Status: By designCodex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.Status: Fixed in releaseError logging in: Port 127.0.0.1:1455 is already in useStatus: WorkaroundToken exchange failed: token endpoint returned status 403 ForbiddenStatus: WorkaroundMCP client for `playwright` failed to start: program not foundStatus: Fixed in release
Related reading
- Agent Harness Lessons From a 500B-Token Decompile: Give Agents a PASS/FAIL OracleAgent harness lessons from a 500B+ token decompile: a byte-matching PASS/FAIL oracle beat the reviewer agent. How agents cheated it and what to copy.
- Codex CLI Needs Resource Budgets, Not Just Token BudgetsA trending Codex SQLite WAL bug is a useful warning for every local coding agent: logs, disks, background processes, and telemetry paths need budgets too.
- Harness Engineering Makes Tokens a Systems BudgetHarness engineering turns tokens into a systems budget. OpenAI's Codex post and Tokenomics research say agent teams need budgets, receipts, and eval loops.
- Droid vs Codex (2026): Factory vs OpenAI for Terminal Coding AgentsFactory Droid vs OpenAI Codex compared on models, pricing, headless CI, multi-agent work, extensibility and openness, with a clear recommendation for each kind of developer.
- Codex CLI 0.171: codex exec --remote, Workspace On by DefaultCodex CLI 0.171.0 adds codex exec --remote to run headless sessions on an existing app server, turns on the TUI workspace by default and picks GPT-6.2 Sol.
- GPT-6.2 Astra and Sol: Pricing, Benchmarks and What to SwitchGPT-6.2 Astra costs $8/$40 per MTok (20% under GPT-6 Astra), Sol stays $2/$10. Vendor-reported benchmarks, cache rates, Codex setup and who should switch.
FAQ
What does "Your access token could not be refreshed because your refresh token was..." mean in Codex CLI?
Codex tried to refresh your ChatGPT sign-in, but the refresh token had already been consumed, so the session cannot authenticate until you sign in again. Current source also has a separate message for an account change: "Your access token could not be refreshed because you have since logged out or signed in to another account. Please sign in again."
How do I fix "Your access token could not be refreshed because your refresh token was..."?
There are 2 documented fixes. Start with the first: Update Codex. A contributor said they think this is fixed in 0.117.0 and that significantly more logging was added; PR #11802 (Fixed a hole in token refresh logic for app server) first shipped in 0.105.0.
Is this Codex CLI error fixed?
Status: Fixed in release. A release fixed this. The affected versions note says where the fix landed. Affected versions: Reported on v0.88.0 (#9634); a contributor said it is fixed in 0.117.0, though later comments on #9634 still report it
Sources
Last verified against 4 sources: official docs, maintainer replies and release notes.
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.