Skip to content

Claude in Chrome: extension permanently disconnects after screenshot/scroll operations #28013

@salacoste

Description

@salacoste

Description

The Claude in Chrome browser extension frequently loses its connection during screenshot and scroll operations, entering an unrecoverable state that requires a full Chrome restart.

Environment

  • OS: macOS (Darwin 25.1.0, Apple Silicon)
  • Chrome: Latest stable
  • Claude Code: Latest (installed via Homebrew)
  • Node: v25.6.1 (native host runtime)

Steps to Reproduce

  1. Start a browser automation session via tabs_context_mcp
  2. Navigate to a page (navigate tool) — works fine
  3. Take a screenshot (computer tool, action: screenshot) — usually works
  4. Scroll the page (computer tool, action: scroll)
  5. Take another screenshot immediately after

Result: "Browser extension is not connected" or "Error capturing screenshot: Detached while handling command."

The extension then enters an infinite exponential backoff reconnection loop (100+ attempts over ~2.5 hours) and never recovers. Only a full Chrome restart resolves the issue.

Log Evidence

From ~/.claude/logs/:

1. Timeout triggers the disconnect

[WARN] [Claude in Chrome] Tool call timeout: computer (1c991a7a) after 120000ms, pending calls: 0

2. Delayed response arrives to dead context

[DEBUG] [Claude in Chrome] Bridge received: {"type":"tool_result","tool_use_id":"1c991a7a-...","content":"Error capturing screenshot: Detached while handling command.","is_error":true}
[Claude in Chrome] Received tool_result for unknown call: 1c991a7a

3. Infinite reconnection loop (never recovers)

[INFO] [Claude in Chrome] Bridge reconnecting in 2000ms (attempt 1)
[INFO] [Claude in Chrome] Bridge reconnecting in 15188ms (attempt 6)
...
[INFO] [Claude in Chrome] Bridge reconnecting in 30000ms (attempt 100)

Operation Timing Analysis

Operation Avg Time Reliability
tabs_context_mcp ~50ms Always works
navigate ~350ms Always works
1st screenshot ~2-5s Usually works
scroll + screenshot ~20s+ Frequently disconnects

Root Cause Analysis

  1. CDP connection fragility: The Chromium DevTools Protocol connection drops during slow operations (screenshots are ~20s)
  2. No graceful recovery: Once the CDP session detaches, there is no mechanism to re-establish it
  3. Orphaned tool calls: Timed-out calls leave no cleanup, and late responses arrive to dead contexts
  4. Exponential backoff never succeeds: The reconnection strategy maxes out at 30s intervals but never actually reconnects — only a Chrome restart works

Configuration

  • ~/.claude/.mcp.json has empty mcpServers: {} — no timeout or keepalive settings available
  • Native host script (~/.claude/chrome/chrome-native-host) is a simple exec node wrapper with no error handling

Suggested Improvements

  1. CDP session recovery: Detect CDP detachment and re-establish the debugging session without requiring Chrome restart
  2. Reconnection cap: After N failed attempts, surface a clear error to the user instead of silent infinite retry
  3. Operation-specific timeouts: Screenshots need longer timeouts than navigation; consider per-operation timeout configuration
  4. Keepalive mechanism: Periodic health check pings on the CDP connection to detect disconnects early
  5. Serialized screenshot queue: Prevent overlapping screenshot operations that can race-condition the CDP session

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:chromebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions