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
- Port fallback in daemon: On
EADDRINUSE/EACCES, try next port (19824 → 19825 → 19827 → ...) and write the actual port to daemon.json
- Port pre-check in CLI: Before spawning, probe the default port with a quick TCP connect; if unavailable, pass
--port <available> to daemon
- Capture daemon stderr: Spawn with
stdio: ["ignore", "pipe", "pipe"] and on timeout, output the daemon's error message instead of the generic hint
- Better error message: Distinguish port conflicts from CDP failures
Problem
bb-browser daemon startfails 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
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
daemon.js -p 19826)Proposed fixes
EADDRINUSE/EACCES, try next port (19824 → 19825 → 19827 → ...) and write the actual port todaemon.json--port <available>to daemonstdio: ["ignore", "pipe", "pipe"]and on timeout, output the daemon's error message instead of the generic hint