Fix: Claude Code Failed to Refresh OAuth Token

Claude Code 2.1.316 stops with this error:

Failed to refresh OAuth token: another Claude Code process is refreshing it or exited mid-refresh

Your saved login expired and needs renewing, but a lock folder says another process is already doing it — and that process is gone. The fix is 60 seconds of patience. Tested November 12, 2026.

Quick Fix Summary

  • Problem: Claude Code 2.1.316 fails with “Failed to refresh OAuth token: another Claude Code process is refreshing it or exited mid-refresh”.
  • Fix: Wait 60 seconds, then run your command again — the stale lock at ~/.claude/.oauth_refresh.lock expires on its own and the next run renews your login.
  • If it keeps coming back: Close every other Claude Code window, then delete the empty lock folder or run /login.

Technical Root Cause

Error Code Affected Version Root Cause Current Status
Failed to refresh OAuth token Claude Code 2.1.316 (November 12, 2026) Saved login expired; lock folder ~/.claude/.oauth_refresh.lock claims another process is renewing it, but that process exited without clearing the lock No code fix needed — the lock goes stale 60 seconds after its last update

Step-by-Step: Fix the OAuth Token Error

Step 1 — Wait 60 Seconds and Retry

This is the verified fix. Run the same command again after a full minute. A lock nobody updates goes stale 60 seconds after its last update, and the next run removes it and renews the login. In the test, a lock left alone for 65 seconds was reclaimed automatically.

While Claude Code is down, keep shipping

A broken login should not stop your workday. GitHub Copilot runs in your editor as a second AI coding assistant, so you can keep writing and reviewing code while Claude Code sorts out its login. (Affiliate link — DebugRadar earns a commission if you sign up through it.)

Step 2 — Check for Other Claude Code Processes

If the error comes back, check whether another Claude Code session is actually running.

macOS / Linux:

ps aux | grep -i claude | grep -v grep

Windows (PowerShell):

tasklist | findstr /I claude

Close any other Claude Code windows. If a stale process is listed on macOS or Linux, end it with kill <PID> using the PID from the output.

Step 3 — Remove the Empty Lock Folder

Only do this if no Claude Code process is running. The lock lives here:

  • macOS / Linux: ~/.claude/.oauth_refresh.lock
  • Windows: %USERPROFILE%\.claude\.oauth_refresh.lock

macOS / Linux:

ls -la ~/.claude/.oauth_refresh.lock
rmdir ~/.claude/.oauth_refresh.lock

Windows (PowerShell):

dir $env:USERPROFILE\.claude\.oauth_refresh.lock
rmdir $env:USERPROFILE\.claude\.oauth_refresh.lock

rmdir only removes an empty folder — that is the safety check. If rmdir refuses, the folder is not empty, so something is still using it. Go back to Step 2.

Step 4 — Re-Login with /login

Inside Claude Code, run:

/login

/login does not wait on the lock. After it completes, run your original command — the token refresh should now go through.

FAQ

Why does the error say “another process” when nothing else is running?

The lock folder was left behind by a process that exited mid-refresh. Claude Code reads the lock, not the process list, so it assumes a refresh is in progress.

Is it safe to delete the lock folder?

Yes, if no Claude Code process is running — and only with rmdir, which refuses to delete a non-empty folder. Never delete the whole ~/.claude folder. Your login and settings live there.

How do I stop this happening again?

Close Claude Code windows cleanly instead of killing the terminal, and avoid running two Claude Code sessions that refresh the login at the same time.

Sources: LaoZhang blog write-up with a same-day test of the lock behaviour (blog.laozhang.ai).

Leave a Comment