Skip to content

fix(chrome): probe IPv4 loopback in ensurePortAvailable to match Chrome CDP bind#94390

Closed
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/issue-94379-Bug-ensurePortAvailable-p
Closed

fix(chrome): probe IPv4 loopback in ensurePortAvailable to match Chrome CDP bind#94390
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/issue-94379-Bug-ensurePortAvailable-p

Conversation

@lsr911

@lsr911 lsr911 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #94379

ensurePortAvailable() used bare net.listen({port}) which binds the IPv6 wildcard on dual-stack hosts, missing IPv4-only loopback occupants. Chrome CDP binds on 127.0.0.1, so the pre-flight guard was silently bypassed. Chrome then fails with bind() failed: Address already in use but the user sees a misleading HTTP 401.

Root Cause

The address family the pre-flight probes (::) does not match the address family Chrome binds (127.0.0.1). An IPv4-only occupant goes undetected.

Change

src/infra/ports.ts — 1 line

- await tryListenOnPort({ port });
+ await tryListenOnPort({ port, host: "127.0.0.1" });

Probe 127.0.0.1 explicitly to match Chrome's CDP bind address family. The sibling checkPortInUse already probes all 4 loopback families — this aligns ensurePortAvailable with that pattern.

Testing

pnpm not available in local environment — relying on CI verification.

🤖 Generated with Claude Code

…me CDP bind

ensurePortAvailable used bare net.listen({port}) which binds IPv6
wildcard on dual-stack, missing IPv4-only loopback occupants.
This caused Chrome CDP launch to fail with misleading HTTP 401
when 127.0.0.1:<port> was already in use.

Probe 127.0.0.1 explicitly to match the address family Chrome
binds its debugging port on.

Fixes openclaw#94379

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: XS r: too-many-prs Auto-close: author has more than twenty active PRs. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 18, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

@openclaw-barnacle

Copy link
Copy Markdown

Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

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

Labels

r: too-many-prs Auto-close: author has more than twenty active PRs. size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ensurePortAvailable() pre-flight misses IPv4-only loopback occupant → Chrome CDP bind fails with misleading "HTTP 401"

1 participant