-
-
Notifications
You must be signed in to change notification settings - Fork 69.2k
CLI handshake fails with gateway closed (1000) — gateway runs fine, CLI completely dead on 2026.3.13 #48167
Description
Summary
CLI commands consistently fail with gateway closed (1000 normal closure): no close reason while the gateway itself runs perfectly — messages flow, cron jobs execute, channels are connected. The CLI is completely non-functional for any gateway interaction.
Environment
- OpenClaw version: 2026.3.13
- Node: v22.22.1
- OS: Linux 6.12.63+deb13-amd64 (Debian 13)
- Gateway bind: loopback (127.0.0.1:18789)
- Auth mode: token
What works
- Gateway service is running (systemd, active/running)
- HTTP dashboard reachable at http://127.0.0.1:18789/
- Telegram channel: fully functional (send/receive)
- WhatsApp channel: functional for inbound (outbound has separate listener bug)
- Cron jobs: executing on schedule (confirmed via run history files)
- Messages flow normally between channels and agents
What's broken
Every CLI command that connects to the gateway fails:
$ openclaw cron list
gateway connect failed: Error: gateway closed (1000):
Error: gateway closed (1000 normal closure): no close reason
Gateway target: ws://127.0.0.1:18789
Source: local loopback
$ openclaw gateway probe --json
{
ok: false,
targets: [{
id: localLoopback,
kind: localLoopback,
url: ws://127.0.0.1:18789,
active: true,
connect: { ok: false, latencyMs: null, error: timeout, close: null }
}]
}
Same failure pattern for: openclaw cron edit, openclaw cron list, openclaw gateway call status, openclaw status (when it tries WS), openclaw message send.
Reproduction
- Install OpenClaw 2026.3.13 via npm global
- Configure gateway with loopback bind and token auth
- Start gateway via systemd
- Confirm gateway is running:
curl http://127.0.0.1:18789/→ HTTP 200 - Run any CLI command:
openclaw cron listoropenclaw gateway probe - Observe: gateway closed (1000) error
Gateway logs
Gateway journal shows WebSocket handshake timeouts:
[ws] handshake timeout conn=... remote=127.0.0.1
[ws] closed before connect conn=... remote=127.0.0.1 ... code=1000 reason=n/a
Workaround
Edit cron jobs directly via ~/.openclaw/cron/jobs.json and restart gateway with systemctl. This works because the gateway reads the file directly — only the CLI↔gateway WS path is broken.
Related issues
- [Bug]: local gateway CLI handshake fails (probe timeout / gateway call closed 1000) even though gateway is running and WS challenge is reachable #45560 — same symptom, 2026.3.12
- [Bug]: openclaw devices list --> Error,[openclaw] Failed to start CLI: Error: gateway closed (1000 normal closure): no close reason #47103 — same symptom, reported 1 day ago
- [Bug]: 2026.3.12: openclaw devices list / devices approve fail against local loopback gateway, while web UI remains functional #45504 — same on 2026.3.12
- Bug: local loopback gateway diagnostics show contradictory unreachable/missing-scope results in 2026.3.13 #46100 — similar loopback diagnostics failure on 2026.3.13
Impact
High. Users cannot manage cron jobs, check gateway status, send messages via CLI, or run any diagnostics. The CLI is the primary management interface and it's completely dead. Gateway runtime is unaffected, but all operational tooling is gone.
Suspected cause
Regression in the CLI↔gateway WebSocket handshake path (GatewayClient.sendConnect or the challenge/response flow). HTTP works, WS challenge is emitted, but the CLI never completes the handshake — gets a 1000 close instead.