Skip to content

daemon: default port 19824 conflicts with Windows IP Helper (iphlpsvc) #217

Description

@zzhan111

Problem

bb-browser daemon start fails on Windows with "Daemon did not start in time" when the default daemon port 19824 is occupied by the Windows IP Helper service (iphlpsvc, PID varies).

Root cause chain

CLI ensureDaemon()
  → discoverCdpPort() succeeds (Chrome CDP on 19825)
  → spawn daemon (no --port flag → defaults to 19824)
  → 19824 occupied by svchost.exe (iphlpsvc) → EACCES
  → daemon crashes, never writes daemon.json
  → CLI 10s poll finds no daemon.json → timeout error

The error message "Chrome CDP is reachable, but the daemon process failed to initialize" is misleading — the actual issue is a port conflict, unrelated to CDP.

Additionally, stdio: "ignore" on the spawned daemon process discards its stderr (which contains the real error: Fatal error: Error: listen EACCES), making diagnosis impossible from the CLI.

Impact

  • Affects Windows users where IP Helper (default Auto-start) binds port 19824
  • Daemon silently crashes with no actionable error output
  • User must manually guess an alternative port (daemon.js -p 19826)

Proposed fixes

  1. Port fallback in daemon: On EADDRINUSE/EACCES, try next port (19824 → 19825 → 19827 → ...) and write the actual port to daemon.json
  2. Port pre-check in CLI: Before spawning, probe the default port with a quick TCP connect; if unavailable, pass --port <available> to daemon
  3. Capture daemon stderr: Spawn with stdio: ["ignore", "pipe", "pipe"] and on timeout, output the daemon's error message instead of the generic hint
  4. Better error message: Distinguish port conflicts from CDP failures

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions