Skip to content

CLI handshake fails with gateway closed (1000) — gateway runs fine, CLI completely dead on 2026.3.13 #48167

@ArisMontclair

Description

@ArisMontclair

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

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

  1. Install OpenClaw 2026.3.13 via npm global
  2. Configure gateway with loopback bind and token auth
  3. Start gateway via systemd
  4. Confirm gateway is running: curl http://127.0.0.1:18789/ → HTTP 200
  5. Run any CLI command: openclaw cron list or openclaw gateway probe
  6. 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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions