Claude CLI crashes with EOPNOTSUPP when browser bridge socket file exists

Status Fixed / completed
Maintainer reply ✓ Yes — whyuan-cc
Activity 3 comments · opened Jan 3, 2026 · closed Jan 8, 2026
💡 Likely answer: A maintainer (whyuan-cc, contributor) responded on this thread — see the highlighted reply below.

Description

Claude CLI crashes on startup when a claude-mcp-browser-bridge-* socket file exists in the temp directory. The CLI tries to fs.watch() the socket file, which fails with EOPNOTSUPP because you cannot watch Unix socket files.

Environment

  • macOS 14.x (Darwin 24.6.0)
  • Bun v1.3.5
  • Claude Code v2.0.76

Steps to Reproduce

  1. Use Claude CLI with Chrome integration (--chrome flag or browser extension)
  2. This creates a socket file at $TMPDIR/claude-mcp-browser-bridge-$USER
  3. Close the Claude session (the socket file remains)
  4. Start a new Claude CLI session
  5. CLI crashes immediately

Error Output

EOPNOTSUPP: unknown error, watch '/var/folders/xx/.../T/claude-mcp-browser-bridge-username'
     path: "/var/folders/xx/.../T/claude-mcp-browser-bridge-username",
  syscall: "watch",
    errno: -102,
 filename: "/var/folders/xx/.../T/claude-mcp-browser-bridge-username",
     code: "EOPNOTSUPP"

      at new FSWatcher (node:fs:29:31)
      at watch (node:fs:296:10)
      at AC_ (/$bunfs/root/claude:392:6265)
      at PMD (/$bunfs/root/claude:392:11479)
      at _watchWithNodeFs (/$bunfs/root/claude:392:6746)
      at _handleFile (/$bunfs/root/claude:392:7489)
      at _addToNodeFs (/$bunfs/root/claude:392:10516)
Bun v1.3.5 (macOS arm64)

Root Cause

The file at $TMPDIR/claude-mcp-browser-bridge-$USER is a Unix socket (file type s):

srw-------@ 1 user  staff  0 Dec 27 07:49 claude-mcp-browser-bridge-username

fs.watch() does not support watching socket files on macOS, resulting in EOPNOTSUPP.

Workaround

Manually delete the socket file:

rm $TMPDIR/claude-mcp-browser-bridge-$USER

Or programmatically before starting Claude CLI:

// Check for and remove stale browser bridge socket files
const files = readdirSync(tmpdir());
for (const file of files) {
  if (file.startsWith('claude-mcp-browser-bridge-')) {
    const filePath = join(tmpdir(), file);
    const stats = statSync(filePath);
    if (stats.isSocket()) {
      unlinkSync(filePath);
    }
  }
}

Expected Behavior

Claude CLI should handle the case where the browser bridge socket file already exists, either by:

  1. Not trying to fs.watch() socket files
  2. Cleaning up stale socket files before attempting to watch
  3. Gracefully handling the EOPNOTSUPP error

View original on GitHub ↗

3 Comments

Whoaa512 · 9 months ago

additional Bug Report: Claude Code crashes when $TMPDIR contains unix socket files

Version: Claude Code 2.0.76 (bundled via airchat-cli)

Platform: macOS arm64, Bun v1.3.5

Description

Claude Code crashes on startup when $TMPDIR contains unix socket files (.sock). The file watcher attempts to call fs.watch() on socket files, which throws EOPNOTSUPP on
macOS.

Reproduction Steps

  1. Have any .sock files in your temp directory (common from VSCode, ssh-askpass, JetBrains, etc.)
  2. Run claude or any command that launches Claude Code
  3. Observe crash with stack trace

Error Output

EOPNOTSUPP: unknown error, watch '/private/var/folders/.../vscode-git-84c6c6bf63.sock'
    path: "/private/var/folders/.../vscode-git-84c6c6bf63.sock",
  syscall: "watch",
    errno: -102,
    code: "EOPNOTSUPP"

      at new FSWatcher (node:fs:29:31)
      at watch (node:fs:296:10)
      at AC_ (/$bunfs/root/claude:392:6265)
      at PMD (/$bunfs/root/claude:392:11479)
      at _watchWithNodeFs (/$bunfs/root/claude:392:6746)
      at _handleFile (/$bunfs/root/claude:392:7489)
      at _addToNodeFs (/$bunfs/root/claude:392:10516)

Expected Behavior

Claude Code should skip socket files (and other non-watchable file types) when setting up file watchers.

Workaround

mkdir -p /tmp/claude-clean && TMPDIR=/tmp/claude-clean claude

Suggested Fix

In the file watcher code, filter out entries where stat.isSocket() returns true, or wrap fs.watch() calls in try/catch to gracefully handle EOPNOTSUPP.

whyuan-cc contributor · 9 months ago

PR was merged and will be in next build.

github-actions[bot] · 9 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.