codex - 💡(How to fix) Fix Codex Desktop on Windows shows blank white window when auth token is invalidated [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20125Fetched 2026-04-30 06:33:34
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4cross-referenced ×2commented ×1

Codex Desktop on Windows opened to a blank white window after the local Codex profile contained an invalidated/stale ChatGPT auth token. The app did not show a sign-in prompt, error state, or recovery option.

Replacing the entire ~/.codex profile with a fresh profile fixed the white screen, but prior conversations appeared missing until the old conversations were manually migrated back while keeping the fresh auth.json.

The local databases were not corrupt (PRAGMA integrity_check returned ok). The strongest signal in the logs is repeated auth failure:

  • auth_401_error_code="token_invalidated"
  • Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.
  • WebSocket connection failed with 401 Unauthorized

The bug appears to be the Desktop app's handling of this auth failure: it should show a re-login/recovery UI instead of rendering a blank white window.

Error Message

Turn error: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.

Root Cause

  • auth_401_error_code="token_invalidated"
  • Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.
  • WebSocket connection failed with 401 Unauthorized

Fix Action

Workaround

The workaround was:

  1. Preserve the old profile as ~/.codex.bad.
  2. Keep the fresh profile's auth.json.
  3. Copy old sessions, archived_sessions, session_backups, generated_images, and session_index.jsonl.
  4. Merge old state_5.sqlite thread tables into the fresh profile.
  5. Do not restore old auth.json or stale auth/session credentials.

Code Example

model = "gpt-5.5"
model_reasoning_effort = "xhigh"

[plugins."browser-use@openai-bundled"]
enabled = true

[windows]
sandbox = "elevated"

---

taskkill /F /IM Codex.exe /T

---

ren "%USERPROFILE%\.codex" ".codex.bad"
ren "%USERPROFILE%\.codex.fresh" ".codex"

---

auth_recovery_mode="managed"
auth_recovery_phase="refresh_token"
auth_recovery_outcome="recovery_failed_permanent"
auth_401_error="401"
auth_401_error_code="token_invalidated"

---

Turn error: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.

---

failed to connect to websocket: HTTP error: 401 Unauthorized,
url: wss://chatgpt.com/backend-api/codex/responses

---

worker quit with fatal: Transport channel closed, when UnexpectedContentType(Some("text/plain; body: {
  \"error\": {
    \"message\": \"Your authentication token has been invalidated. Please try signing in again.\",
    \"type\": \"invalid_request_error\",
    \"code\": \"token_invalidated\",
    \"param\": null
  },
  \"status\": 401
}"))

---

state_5.sqlite integrity_check: ok
logs_2.sqlite integrity_check: ok
RAW_BUFFERClick to expand / collapse

Summary

Codex Desktop on Windows opened to a blank white window after the local Codex profile contained an invalidated/stale ChatGPT auth token. The app did not show a sign-in prompt, error state, or recovery option.

Replacing the entire ~/.codex profile with a fresh profile fixed the white screen, but prior conversations appeared missing until the old conversations were manually migrated back while keeping the fresh auth.json.

The local databases were not corrupt (PRAGMA integrity_check returned ok). The strongest signal in the logs is repeated auth failure:

  • auth_401_error_code="token_invalidated"
  • Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.
  • WebSocket connection failed with 401 Unauthorized

The bug appears to be the Desktop app's handling of this auth failure: it should show a re-login/recovery UI instead of rendering a blank white window.

Environment

  • Product: Codex Desktop app
  • Platform: Windows
  • OS: Windows 10, build 19045
  • Install path observed: C:\Program Files\WindowsApps\OpenAI.Codex_26.422.8496.0_x64__2p2nqsd0c76g0\app\Codex.exe
  • Product version observed from the running process: 26.422.62136
  • App package folder observed: OpenAI.Codex_26.422.8496.0_x64__2p2nqsd0c76g0
  • Auth mode: ChatGPT account auth
  • Current config excerpt:
model = "gpt-5.5"
model_reasoning_effort = "xhigh"

[plugins."browser-use@openai-bundled"]
enabled = true

[windows]
sandbox = "elevated"

Steps to Reproduce

I do not know the exact original trigger, but this is the state transition that reproduced the recovery behavior:

  1. Start Codex Desktop with an existing ~/.codex profile that contains many old conversations and a stale/invalidated auth.json.
  2. Codex Desktop opens as a blank white window.
  3. Kill Codex:
taskkill /F /IM Codex.exe /T
  1. Move the existing profile aside and restore a fresh profile:
ren "%USERPROFILE%\.codex" ".codex.bad"
ren "%USERPROFILE%\.codex.fresh" ".codex"
  1. Codex opens normally with the fresh profile, but prior conversations/settings are gone from the UI.
  2. If the old profile is restored wholesale, the blank white window returns.
  3. If old conversations/session files and state_5.sqlite thread records are migrated into the fresh profile while keeping the fresh auth.json, Codex opens normally and old conversations return.

Expected Behavior

When the ChatGPT auth token is invalidated or the refresh token has already been used, Codex Desktop should:

  • Render a clear auth error UI.
  • Prompt the user to sign in again.
  • Avoid blank-window failure.
  • Preserve existing local conversations and workspace metadata.
  • Ideally provide a safe recovery path that moves stale auth aside without requiring manual profile surgery.

Actual Behavior

Codex Desktop showed a blank white window when launched with the old profile. No visible error or sign-in prompt appeared.

The only reliable recovery was to:

  • Create/use a fresh ~/.codex profile with a valid login.
  • Keep the fresh auth.json.
  • Manually migrate old session/conversation state back into the fresh profile.
  • Avoid restoring the old auth.json.

Relevant Sanitized Logs

From the old profile's logs_2.sqlite:

auth_recovery_mode="managed"
auth_recovery_phase="refresh_token"
auth_recovery_outcome="recovery_failed_permanent"
auth_401_error="401"
auth_401_error_code="token_invalidated"
Turn error: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.
failed to connect to websocket: HTTP error: 401 Unauthorized,
url: wss://chatgpt.com/backend-api/codex/responses
worker quit with fatal: Transport channel closed, when UnexpectedContentType(Some("text/plain; body: {
  \"error\": {
    \"message\": \"Your authentication token has been invalidated. Please try signing in again.\",
    \"type\": \"invalid_request_error\",
    \"code\": \"token_invalidated\",
    \"param\": null
  },
  \"status\": 401
}"))

Local Checks

The profile databases did not appear physically corrupt:

state_5.sqlite integrity_check: ok
logs_2.sqlite integrity_check: ok

The old profile contained valid conversation/session data. After migrating conversation data into a fresh logged-in profile, the conversations were visible again.

Workaround

The workaround was:

  1. Preserve the old profile as ~/.codex.bad.
  2. Keep the fresh profile's auth.json.
  3. Copy old sessions, archived_sessions, session_backups, generated_images, and session_index.jsonl.
  4. Merge old state_5.sqlite thread tables into the fresh profile.
  5. Do not restore old auth.json or stale auth/session credentials.

Request

Please improve Codex Desktop's auth failure handling so that invalidated/stale auth state cannot leave the user with a blank white window. A visible sign-in prompt or profile recovery path would prevent data-loss panic and avoid manual profile editing.

It may also be useful to document which files are safe to migrate from an old profile and which files, such as auth.json, should not be copied when recovering from auth-token invalidation.

extent analysis

TL;DR

The most likely fix is to improve Codex Desktop's handling of auth failures by displaying a clear error UI and prompting the user to sign in again when encountering an invalidated or stale auth token.

Guidance

  • The issue seems to stem from the app's inability to handle auth token invalidation, leading to a blank white window instead of a sign-in prompt.
  • To verify the issue, check the logs for auth_401_error_code="token_invalidated" and Your access token could not be refreshed because your refresh token was already used errors.
  • A temporary workaround involves creating a fresh profile, keeping the new auth.json, and manually migrating old conversation/session data into the fresh profile.
  • To mitigate the issue, consider implementing a retry mechanism for auth token refresh or providing a clear error message and sign-in prompt when encountering an invalid token.

Example

No code snippet is provided as the issue seems to be related to the app's logic and error handling rather than a specific code block.

Notes

The provided workaround requires manual profile editing, which may not be feasible for all users. A more robust solution would involve improving the app's auth failure handling to provide a seamless recovery experience.

Recommendation

Apply a workaround by creating a fresh profile and manually migrating old conversation/session data until a fixed version of Codex Desktop is available that properly handles auth token invalidation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop on Windows shows blank white window when auth token is invalidated [1 comments, 2 participants]