claude-in-chrome: first tool call in a session reports "extension is not connected" — discovery waits only 1 ms for peer_connected
Description
The first claude-in-chrome tool call in a new session frequently returns "Browser extension is not connected", even though the extension is installed, paired, signed into the right account, and connected. A retry a few seconds later succeeds with no user action.
The cause is a 1 ms wait in the bridge discovery path.
Root cause
In discoverAndSelectExtension() (claude-code 2.1.220):
queryBridgeExtensions()sendslist_extensionsover the WebSocket bridge and waits up to 5000 ms for the reply.- If the reply is an empty list, the code waits for a
peer_connectedevent before giving up. That wait isDKt, andDKt = 1— one millisecond. - It then sets
discoveryComplete = truewith noselectedDeviceId. The nextcallToolthrowsNo Chrome extension connected after discovery, which surfaces as the "Browser extension is not connected" text.
Later, when the extension registers with the bridge, the peer_connected handler resets discoveryComplete = false. The next tool call re-runs discovery and succeeds.
So the retry always works, and the first call always loses whenever the extension is not already registered at that exact instant. Chrome suspends an idle MV3 extension service worker, so "not already registered" is the common case at the start of a session.
Steps to reproduce
- Pair the Chrome extension. Confirm
list_connected_browsersreturns the browser. - Leave Chrome idle long enough for the extension service worker to suspend.
- Start a new Claude Code session.
- Call
mcp__claude-in-chrome__tabs_context_mcpas the first browser tool call.
Expected behavior
Discovery waits a few seconds for peer_connected before it reports the extension as disconnected.
Actual behavior
Discovery waits 1 ms. The first call returns:
Browser extension is not connected. Please ensure the Claude browser extension is installed and running (https://claude.ai/chrome), and that you are logged into claude.ai with the same account as Claude Code. ...
An immediate retry returns the browser normally.
Impact
The error text points the user at installation, account mismatch, and restarting Chrome. None of those is the problem. Users spend time on a setup that is already correct. Several open issues describe the same symptom and may share this cause: #83645, #70515, #84055.
Suggested fix
Raise the peer_connected grace window from 1 ms to a few seconds. A retry loop around the empty list_extensions result would also work.
Environment
- claude-code 2.1.220 (native installer, Homebrew cask)
- macOS 13.7.8, x86_64
- Chrome extension
fcoeoabgfenejglbffodgkkbkcdhcgfn, paired,isLocal: true - Bridge:
wss://bridge.claudeusercontent.com
Note: the constant names above come from the minified bundle, so they will differ in source.