[BUG] --chrome opens a reconnect browser tab even in headless -p mode (any native host manifest rewrite is treated as first-time install)

Open 💬 0 comments Opened Jun 10, 2026 by NaCl5alt

Environment

  • Claude Code CLI: 2.1.168
  • OS: macOS (Darwin 25.4.0)

Summary

When the --chrome native-host install logic decides the native messaging host manifest needs to be (re)written, it treats this as a "first-time install" and unconditionally runs open -a "Google Chrome" https://clau.de/chrome/reconnect — even in non-interactive claude -p runs (the binary logs First-time install detected, opening reconnect page). A headless invocation should never open a browser tab.

Because any manifest content difference triggers the rewrite (and therefore the tab), this re-fires whenever the manifest is missing or its content has drifted for any reason — e.g. it was removed or restored by backup/sync tooling, or the expected wrapper path changed since the last write. The reconnect page is clearly meant for an interactive user, but nothing gates it on a TTY.

Steps to reproduce

  1. Have the Claude in Chrome extension installed and the native host manifest present.
  2. Delete one browser's manifest file (simulating content drift), e.g. ~/Library/Application Support/Vivaldi/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json.
  3. Run claude -p "ok" --chrome from a non-interactive context.
  4. The CLI re-creates the manifest and opens a claude.ai reconnect tab, despite -p.

Expected behavior

  • -p / non-interactive runs never spawn open for the reconnect page (at most print a notice).
  • Re-writing a manifest that merely drifted (wrapper content/protocol unchanged) is not treated as a first-time install.

Actual behavior

A claude.ai tab opens from headless runs whenever the manifest is (re)written.

Workaround

Freeze the manifests with chflags uchg once they are correct. The CLI's manifest write failure is caught and only logged (no crash), and the extension keeps working.

Suggested fix

  • Treat "manifest exists but content differs" as an update, not a first-time install (no reconnect page).
  • Gate the open … /chrome/reconnect call on an interactive TTY (never in -p).

View original on GitHub ↗