[Bug] Claude in Chrome: misleading "Invalid token or user mismatch" with no auto-recovery (two distinct root causes)

Resolved 💬 4 comments Opened Mar 8, 2026 by axisrow Closed Mar 8, 2026

Description

The error Invalid token or user mismatch is raised in two completely different situations but with the same misleading message, making diagnosis impossible. In both cases the retry loop never auto-recovers.

Root cause 1 — Account mismatch (immediate failure)

Claude Code authenticated under account A, Chrome extension session belongs to account B.
Connection fails immediately from the very first attempt.

Root cause 2 — Service worker gone idle (failure after ~6 hours)

Bridge works fine initially. After ~6 hours of inactivity, Chrome kills the extension's service worker. On next reconnect the token is stale/invalid. Per the docs: _"During long sessions, the Chrome extension's service worker might go idle"_ — but the runtime never surfaces the fix.

Steps to reproduce (Root cause 2)

  1. Start a Claude Code session with debug logging (/debug)
  2. Use any mcp__claude-in-chrome__* tool — confirm bridge connects successfully
  3. Stop the extension service worker: chrome://extensions → Claude extension → Service Worker → Stop
  4. Immediately try any Chrome tool again

Expected behavior

Either:

  • Auto-recover by restarting the service worker, OR
  • Show an actionable error: _"Extension service worker went idle. Run /chrome → Reconnect extension."_

Actual behavior

Infinite retry loop that never recovers, and a misleading error message that implies an account problem:

2026-03-06T18:27:33Z [INFO]  [Claude in Chrome] Not connecting, starting connection...
2026-03-06T18:27:33Z [DEBUG] [Claude in Chrome] Fetching user ID for bridge connection
2026-03-06T18:27:33Z [DEBUG] [Claude in Chrome] Fetching OAuth token for bridge connection
2026-03-06T18:27:33Z [INFO]  [Claude in Chrome] WebSocket connected, sending connect message
2026-03-06T18:27:33Z [WARN]  [Claude in Chrome] Bridge error: Invalid token or user mismatch
2026-03-06T18:27:33Z [INFO]  [Claude in Chrome] Bridge connection closed (code: 1008, duration: 0ms)
2026-03-06T18:27:33Z [INFO]  [Claude in Chrome] Bridge reconnecting in 2000ms (attempt 1)
2026-03-06T18:27:35Z [WARN]  [Claude in Chrome] Bridge error: Invalid token or user mismatch
2026-03-06T18:27:36Z [INFO]  [Claude in Chrome] Bridge reconnecting in 3000ms (attempt 2)
2026-03-06T18:27:40Z [WARN]  [Claude in Chrome] Bridge error: Invalid token or user mismatch
2026-03-06T18:27:40Z [INFO]  [Claude in Chrome] Bridge reconnecting in 4500ms (attempt 3)
... (continues indefinitely with exponential backoff, never resolves)

Suggested improvements

  1. Distinguish error types: "Service worker went idle" vs "Account mismatch" — these need different messages and different recovery flows
  2. Auto-recovery: When the service worker is detected as idle, restart it automatically instead of retrying the same failing connection
  3. Surface the fix: After N failed retries, show: _"Bridge connection failed. Try /chrome → Reconnect extension"_ in the Claude Code UI

Versions

  • Claude Code: 2.1.71
  • macOS: 26.3.1
  • Chrome: (please fill in from chrome://settings/help)
  • Extension: (please fill in from chrome://extensions)

References

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗