openclaw - 💡(How to fix) Fix Bug: Sub-Agents connect to wrong port (18789 instead of 63333) [2 comments, 3 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#48977Fetched 2026-04-08 00:50:14
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
0
Timeline (top)
commented ×2

Sub-Agents spawned via sessions_spawn fail to connect with "pairing required" error because they attempt to connect to the Gateway Control UI port (18789) instead of the Main Agent port (63333).

Error Message

Sub-Agents spawned via sessions_spawn fail to connect with "pairing required" error because they attempt to connect to the Gateway Control UI port (18789) instead of the Main Agent port (63333). 3. Error occurs:

Root Cause

The Gateway has two ports:

  • 18789: Control UI / Dashboard (requires pairing)
  • 63333: Main Agent

Sub-Agents should connect to port 63333.

Fix Action

Workaround

Run tasks directly in Main Session instead of spawning sub-agents.

Code Example

{
  "gateway": {
    "port": 63333,
    "mode": "local",
    "bind": "auto",
    "controlUi": {
      "allowInsecureAuth": true,
      "dangerouslyDisableDeviceAuth": true
    },
    "auth": {
      "mode": "token",
      "token": "REDACTED"
    }
  }
}

---

sessions_spawn --runtime subagent --model moonshot/kimi-code --task "test" --mode run

---

gateway closed (1008): pairing required
   Gateway target: ws://127.0.0.1:18789
RAW_BUFFERClick to expand / collapse

Summary

Sub-Agents spawned via sessions_spawn fail to connect with "pairing required" error because they attempt to connect to the Gateway Control UI port (18789) instead of the Main Agent port (63333).

Environment

  • OpenClaw Version: 2026.2.x (latest)
  • Runtime: Docker Container (Debian 13)
  • Host: Ubuntu 24.04 VPS
  • Node Version: v22.22.0

Configuration

{
  "gateway": {
    "port": 63333,
    "mode": "local",
    "bind": "auto",
    "controlUi": {
      "allowInsecureAuth": true,
      "dangerouslyDisableDeviceAuth": true
    },
    "auth": {
      "mode": "token",
      "token": "REDACTED"
    }
  }
}

Steps to Reproduce

  1. Start OpenClaw Gateway (listens on both 18789 and 63333)
  2. Attempt to spawn a sub-agent:
    sessions_spawn --runtime subagent --model moonshot/kimi-code --task "test" --mode run
  3. Error occurs:
    gateway closed (1008): pairing required
    Gateway target: ws://127.0.0.1:18789

Expected Behavior

Sub-Agent should connect to the Main Agent on port 63333, not to the Gateway Control UI on port 18789.

Actual Behavior

Sub-Agent attempts to connect to ws://127.0.0.1:18789 which requires pairing.

Analysis

The Gateway has two ports:

  • 18789: Control UI / Dashboard (requires pairing)
  • 63333: Main Agent

Sub-Agents should connect to port 63333.

Workaround

Run tasks directly in Main Session instead of spawning sub-agents.

extent analysis

Fix Plan

To resolve the issue, we need to configure the sub-agents to connect to the Main Agent port (63333) instead of the Gateway Control UI port (18789).

Step-by-Step Solution

  • Update the sessions_spawn command to specify the correct port:
    sessions_spawn --runtime subagent --model moonshot/kimi-code --task "test" --mode run --gateway-port 63333
  • Alternatively, update the OpenClaw configuration to use the Main Agent port as the default for sub-agents:
    {
      "gateway": {
        "port": 63333,
        "mode": "local",
        "bind": "auto",
        "subagentPort": 63333, // Add this line
        "controlUi": {
          "allowInsecureAuth": true,
          "dangerouslyDisableDeviceAuth": true
        },
        "auth": {
          "mode": "token",
          "token": "REDACTED"
        }
      }
    }
  • If the above configuration change is not possible, you can also use environment variables to override the gateway port for sub-agents:
    GATEWAY_PORT=63333 sessions_spawn --runtime subagent --model moonshot/kimi-code --task "test" --mode run

Verification

To verify that the fix worked, run the sessions_spawn command with the updated configuration or environment variable and check that the sub-agent connects to the correct port (63333) without requiring pairing.

Extra Tips

  • Make sure to update the documentation and guides to reflect the correct port usage for sub-agents.
  • Consider implementing a check in the OpenClaw configuration validation to ensure that the sub-agent port is set correctly.

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 - 💡(How to fix) Fix Bug: Sub-Agents connect to wrong port (18789 instead of 63333) [2 comments, 3 participants]