[BUG] claude-in-chrome extension: service worker fails to connect when no Chrome window is focused

Resolved 💬 2 comments Opened Apr 11, 2026 by Hantica Closed May 23, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug:
In a multi-profile Chrome setup, only one profile's extension successfully connects to the claude-in-chrome MCP daemon. Calling
switch_browser in a second Claude Code session returns "No other browsers available to switch to" even when the other profile's
extension is installed and enabled.

Root cause (from Chrome DevTools console on the non-connecting profile's service worker):
No current window
at chrome.windows.getCurrent()
The extension's background service worker calls chrome.windows.getCurrent(), which returns null when the profile's window is not
the currently focused window (common in multi-profile or background wake-up scenarios). This blocks the extension from registering
with the MCP daemon.

Workaround: Click Profile B's Chrome window to bring it frontmost, then wake service worker. Fragile and doesn't scale to parallel
sessions.

What Should Happen?

The claude-in-chrome extension service worker should use chrome.windows.getLastFocused() (or handle the null case from getCurrent() gracefully) so that waking the service worker while a non-Chrome app is frontmost still allows the extension to register with the MCP daemon.

Error Messages/Logs

// From chrome://extensions → Profile B → Claude extension → service worker DevTools console:
  Uncaught (in promise) Error: No current window
      at chrome.windows.getCurrent()

  // From Claude Code session #2:
  Error: No other browsers available to switch to. Open Chrome with the Claude extension in another browser to switch.

Steps to Reproduce

Reproduction:

  1. Open Chrome with two profiles (Profile A, Profile B), install Claude extension on both
  2. Start Claude Code session #1 → call mcp__claude-in-chrome__switch_browser → connect to Profile A
  3. Focus any non-Chrome app (Terminal)
  4. Start Claude Code session #2 → call switch_browser → expects Profile B, gets "No other browsers available"
  5. Open chrome://extensions in Profile B → service worker shows chrome.windows.getCurrent() null error

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code CLI 2.1.101

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

  • Single Chrome instance with 2 profiles (verified via ps -eo pid,ppid,command | grep Chrome — one main PID)
  • Both profiles signed in with different Google accounts
  • Both extensions enabled in chrome://extensions
  • Workaround: manually focusing the target Chrome profile window before waking the service worker works, but is fragile and breaks

parallel multi-session workflows

View original on GitHub ↗

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