#8614: fix(browser): detect early chromium exit to prevent startup hang
stale
Cluster:
Browser Enhancements and Fixes
Fixes #8611.
### Problem
Currently, `launchOpenClawChrome` waits blindly for 15 seconds for the CDP port to open. If Chromium crashes on startup (e.g. due to missing libraries in Docker, or port conflict), the Gateway hangs for the full 15s before throwing a generic timeout error.
### Solution
This PR adds a `proc.on('exit')` listener during the wait loop. If the process exits prematurely, we capture the exit code and reject the promise immediately.
This improves the error message (we know it exited vs timed out) and eliminates the 15s delay on failure.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates `launchOpenClawChrome` to detect when the spawned Chromium process exits while waiting for the CDP port to become reachable, and to fail fast with a more specific error instead of waiting the full 15s timeout.
It fits into the browser-launch path by improving the “CDP readiness wait” loop after spawning the main browser process, keeping the rest of the profile bootstrap/decoration logic unchanged.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge and should improve failure behavior during browser startup.
- Change is small and localized to the CDP wait loop; main remaining concern is incomplete early-exit handling (listener cleanup on all error paths and richer exit context such as signal/stderr).
- src/browser/chrome.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#13568: Fix browser (OpenClaw-managed) launch fail by binding remote debugg...
by singlag · 2026-02-10
83.9%
#19495: fix: handle Chrome process re-parenting on Windows
by andenwick · 2026-02-17
79.8%
#14944: fix(browser): prefer openclaw profile in headless/noSandbox environ...
by BenediktSchackenberg · 2026-02-12
77.6%
#22997: fix(browser): remove stale Chrome SingletonLock before launch
by CryptoYogiLLC · 2026-02-21
77.5%
#8282: Fix: Enable browser downloads via CDP Browser.setDownloadBehavior
by vishaltandale00 · 2026-02-03
76.7%
#16905: fix: prevent excessive Chrome tab creation on startup
by MisterGuy420 · 2026-02-15
76.6%
#14784: fix(browser): clarify stale targetId errors (tab not found)
by sovushik · 2026-02-12
76.6%
#9020: fix(browser): skip port ownership and WS reachability checks for re...
by yepack · 2026-02-04
76.3%
#6193: fix(browser): default to openclaw profile instead of chrome extensi...
by mikezaoldyeck · 2026-02-01
76.2%
#23363: Browser: fallback to managed profile and improve runtime diagnostics
by isdoho · 2026-02-22
76.1%