Skip to content

CLI crashes with an unhandled 'error' event when the browser opener cannot be spawned #2531

Closed

Description

@cliffhall

Problem

Found in the v2.9.0 release smoke (#2530), driving #2410's fix from the production build.

#2410 / PR #2499 bounded openUrl() (clients/cli/src/open-url.ts) with a timeout and a .catch, so a failed open prints Could not open a browser automatically (…). Open the URL above manually. That covers an opener that rejects. It does not cover one that cannot be spawned:

  • open (10.2.0) resolves as soon as it has called childProcess.spawn(...) and returns the ChildProcess.
  • A spawn failure (ENOENT) is emitted afterwards as an 'error' event on that child. open only attaches subprocess.once("error", reject) when called with { wait: true } (node_modules/open/index.js:244-263), and the CLI does not pass it.
  • Nothing listens for the event, so Node treats it as an unhandled 'error' and the process crashes, which is the outcome CLI's open() call has no timeout, no catch, and no fallback message #2410 set out to prevent. The fallback line is never printed.

Not a regression: 2.8.0 crashes the same way.

Reproduce

node test-servers/build/server-composable.js --config test-servers/configs/oauth-revocation-http.json   # :8083
env -i HOME=$HOME PATH=/nonexistent MCP_STORAGE_DIR=$(mktemp -d) MCP_INSPECTOR_SECRET_STORE=memory \
  MCP_AUTO_OPEN_ENABLED=true "$(command -v node)" clients/launcher/build/index.js \
  --cli --server-url http://127.0.0.1:8083/mcp --transport http --method tools/list

Observed: Please navigate to: <url> followed by node:events … throw er; // Unhandled 'error' event … Error: spawn open ENOENT, and the process exits.

Expected

A spawn failure is handled like any other open failure: the fallback message is printed and the CLI keeps waiting for the callback.

Likelihood

Low on a normal machine (/usr/bin/open on macOS; open ships its own xdg-open on Linux), but real wherever the opener binary is missing from PATH: minimal containers, sandboxed or env -i launches.

Activity

  1. added this to the v2.9.0 milestone on Sep 30, 2026
  2. added
    bug
    on Sep 30, 2026
  3. self-assigned this
    on Sep 30, 2026
  4. added
    v2
    on Sep 30, 2026
  5. cliffhall commented on Sep 30, 2026

    @cliffhall
    MemberAuthor

    Triage: Priority High (total 11)

    • Severity 3 — the CLI crashes instead of falling back (opener missing from PATH)
    • Urgency 5 — blocking the v2.9.0 release (maintainer decision to fix before shipping)
    • Bonuses: +1 bug label, +1 milestoned (v2.9.0), +1 assigned

    Board: #28, Status In Progress (filed through the documented flow and started immediately).

  6. cliffhall commented on Sep 30, 2026

    @cliffhall
    MemberAuthor

    Shipped in #2534 (merged to v2/main).

  7. added a commit that references this issue on Oct 4, 2026
    b50369d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions