openclaw - ✅(Solved) Fix [Browser] Chrome CDP websocket unreachable after start - macOS 26.4 arm64 [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#65093Fetched 2026-04-12 13:25:38
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
cross-referenced ×2commented ×1subscribed ×1

Error Message

2026-04-12T09:25:27.365+08:00 [browser/chrome]: 🦞 openclaw browser started (chrome) profile "openclaw" on 127.0.0.1:18800 (pid 11630)

2026-04-12T09:25:35.454+08:00 [gateway/ws]: ⇄ res ✗ browser.request 10023ms errorCode=UNAVAILABLE errorMessage=Error: Chrome CDP websocket for profile "openclaw" is not reachable after start.

Fix Action

Fixed

PR fix notes

PR #65101: browser: wait longer for local CDP websocket after launch

Description (problem / solution / changelog)

Made with Copilot | fully reviewed by human | fully tested

Summary

  • Problem: openclaw browser start and openclaw browser open can still fail with Chrome CDP websocket for profile "openclaw" is not reachable after start. after Chrome launches on slower local startups.
  • Why it matters: local browser automation stays unavailable even though Chrome itself comes up.
  • What changed: extended the post-launch CDP-ready retry window and increased the loopback per-attempt timeout budget so local Chrome has longer to make the websocket ready; added a regression assertion that locks in the wider timeout budget.
  • What did NOT change: Chrome spawn args, remote CDP profile behavior, and the initial HTTP reachability gate.

Root Cause

  • Root cause: waitForCdpReadyAfterLaunch() uses server-context.constants.ts values that capped loopback retries at 75-250ms per attempt, which only gave local profiles a 200-500ms websocket readiness budget after launch.
  • Missing detection / guardrail: the existing post-launch test covered retry behavior but did not verify the timeout values passed into isChromeCdpReady().
  • Contributing context: launchOpenClawChrome() already waits for /json/version; the follow-up websocket readiness pass was much stricter than the initial launch window.

Testing

  • pnpm test -- extensions/browser/src/browser/server-context.ensure-browser-available.waits-for-cdp-ready.test.ts
  • pnpm test -- extensions/browser/src/browser/cdp-timeouts.test.ts extensions/browser/src/browser/server-context.stop-running-browser.test.ts
  • Rebasing onto the latest origin/main completed cleanly before refreshing PR CI

Closes #65093

Changed files

  • extensions/browser/src/browser/server-context.constants.ts (modified, +3/-3)
  • extensions/browser/src/browser/server-context.ensure-browser-available.waits-for-cdp-ready.test.ts (modified, +15/-1)

Code Example

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  --remote-debugging-port=18800 \
  --user-data-dir=/tmp/chrome-test \
  --headless --no-first-run --disable-gpu &
sleep 5
curl -s http://127.0.0.1:18800/json/version
# ✅ 成功返回 Chrome 版本信息

---

2026-04-12T09:25:27.365+08:00 [browser/chrome]: 🦞 openclaw browser started (chrome) 
  profile "openclaw" on 127.0.0.1:18800 (pid 11630)

2026-04-12T09:25:35.454+08:00 [gateway/ws]: ⇄ res ✗ browser.request 10023ms 
  errorCode=UNAVAILABLE 
  errorMessage=Error: Chrome CDP websocket for profile "openclaw" is not reachable after start.

---

// extensions/browser/src/browser/cdp.helpers.ts
CHROME_LAUNCH_READY_WINDOW_MS = 5000  // Chrome 启动就绪窗口:5 秒

---

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  --remote-debugging-port=18800 \
  --user-data-dir=/tmp/chrome-openclaw \
  --headless --no-first-run --disable-gpu &
RAW_BUFFERClick to expand / collapse

问题描述

执行 openclaw browser startopenclaw browser open 时,日志显示 Chrome 已启动,但 CDP 端口 18800 实际未被监听,10 秒后超时返回 UNAVAILABLE

环境信息

  • OpenClaw: 2026.4.11 (769908e)
  • macOS: 26.4 (arm64)
  • Node: 22.22.0
  • Chrome: 147.0.7727.55

复现步骤

  1. 执行 openclaw browser start
  2. 日志显示:🦞 openclaw browser started (chrome) profile "openclaw" on 127.0.0.1:18800 (pid XXXX)
  3. 10 秒后报错:Error: Chrome CDP websocket for profile "openclaw" is not reachable after start.
  4. 检查端口:lsof -i :18800 无输出

验证测试

手动启动 Chrome 可正常监听 CDP 端口

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  --remote-debugging-port=18800 \
  --user-data-dir=/tmp/chrome-test \
  --headless --no-first-run --disable-gpu &
sleep 5
curl -s http://127.0.0.1:18800/json/version
# ✅ 成功返回 Chrome 版本信息

结论: Chrome 本身正常,问题出在 OpenClaw 的浏览器启动逻辑。

日志证据

2026-04-12T09:25:27.365+08:00 [browser/chrome]: 🦞 openclaw browser started (chrome) 
  profile "openclaw" on 127.0.0.1:18800 (pid 11630)

2026-04-12T09:25:35.454+08:00 [gateway/ws]: ⇄ res ✗ browser.request 10023ms 
  errorCode=UNAVAILABLE 
  errorMessage=Error: Chrome CDP websocket for profile "openclaw" is not reachable after start.

技术分析

查看 OpenClaw 源码发现:

// extensions/browser/src/browser/cdp.helpers.ts
CHROME_LAUNCH_READY_WINDOW_MS = 5000  // Chrome 启动就绪窗口:5 秒

但 Gateway 等待 10 秒后超时,说明 Chrome 实际启动时间超过 5 秒。

已尝试方案

  • 清理 Chrome 进程 ❌
  • 清理用户数据目录 ❌
  • 重启 Gateway ❌
  • 系统更新 (2026.4.10→2026.4.11) ❌
  • 手动启动 Chrome ✅ (CDP 正常监听)

建议修复

  1. 增加 Chrome 启动就绪窗口:将 CHROME_LAUNCH_READY_WINDOW_MS 从 5000ms 增加到 15000-20000ms
  2. 增加 Gateway 连接重试:添加 CDP 端口就绪检查和重试机制
  3. 优化 Chrome 启动参数:检查 macOS 特定的启动参数需求

影响范围

  • openclaw browser open 命令失败
  • openclaw browser snapshot 命令失败
  • 所有依赖浏览器的功能(网页抓取、晒票采集等)无法使用

临时解决方案

手动启动 Chrome 并保持运行:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  --remote-debugging-port=18800 \
  --user-data-dir=/tmp/chrome-openclaw \
  --headless --no-first-run --disable-gpu &

但 OpenClaw 无法自动使用手动 Chrome。

extent analysis

TL;DR

Increase the Chrome launch ready window to 15-20 seconds to allow for longer startup times.

Guidance

  • Verify that the issue is resolved by increasing the CHROME_LAUNCH_READY_WINDOW_MS value in cdp.helpers.ts to 15000-20000ms.
  • Consider adding a CDP port readiness check and retry mechanism to the Gateway to improve robustness.
  • Review macOS-specific Chrome launch parameters to ensure optimal startup performance.

Example

// extensions/browser/src/browser/cdp.helpers.ts
CHROME_LAUNCH_READY_WINDOW_MS = 15000  // Increased Chrome launch ready window

Notes

The issue may be specific to the combination of OpenClaw, Chrome, and macOS versions used. Further testing may be necessary to confirm the effectiveness of the suggested fix.

Recommendation

Apply the workaround by increasing the Chrome launch ready window to 15-20 seconds, as this is a relatively simple and non-invasive change that can help resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Browser] Chrome CDP websocket unreachable after start - macOS 26.4 arm64 [1 pull requests, 1 comments, 2 participants]