openclaw - 💡(How to fix) Fix [Bug]: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway [1 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#59882Fetched 2026-04-08 02:39:19
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×2referenced ×1

Title: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway

Summary:

When tools.exec.ask is set to "always" (with security: "full"), all exec commands fail with:

Exec approval registration failed: Error: gateway closed (1008): pairing required
Gateway target: ws://127.0.0.1:18789
Source: local loopback

Environment:

  • OpenClaw 2026.4.1 (da64a97)
  • macOS 15.5 (arm64), Node 25.9.0
  • Gateway mode: local, bind: loopback
  • Auth mode: token (with valid token set)

Steps to reproduce:

  1. Set tools.exec.security: "full" and tools.exec.ask: "always" in openclaw.json
  2. Set host approvals via openclaw approvals set with defaults.ask: "always" and defaults.askFallback: "deny"
  3. Restart gateway
  4. Agent attempts any exec command (e.g., echo hello)

Expected: Approval prompt appears in Control UI; command runs after approval.

Actual: Exec immediately fails with "gateway closed (1008): pairing required" before reaching the approval stage. The approval WebSocket connection to the gateway is rejected.

Workaround: Setting tools.exec.ask: "off" allows exec to function normally. The issue is specific to the approval registration WebSocket, not exec itself.

Diagnostic output:

  • openclaw gateway probe → Reachable: yes, RPC: ok
  • openclaw gateway status → Runtime: running, RPC probe: ok
  • openclaw doctor → no blocking issues
  • openclaw approvals get → file exists, socket path set, defaults configured

Error Message

Exec approval registration failed: Error: gateway closed (1008): pairing required Gateway target: ws://127.0.0.1:18789 Source: local loopback

Root Cause

Title: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway

Summary:

When tools.exec.ask is set to "always" (with security: "full"), all exec commands fail with:

Exec approval registration failed: Error: gateway closed (1008): pairing required
Gateway target: ws://127.0.0.1:18789
Source: local loopback

Environment:

  • OpenClaw 2026.4.1 (da64a97)
  • macOS 15.5 (arm64), Node 25.9.0
  • Gateway mode: local, bind: loopback
  • Auth mode: token (with valid token set)

Steps to reproduce:

  1. Set tools.exec.security: "full" and tools.exec.ask: "always" in openclaw.json
  2. Set host approvals via openclaw approvals set with defaults.ask: "always" and defaults.askFallback: "deny"
  3. Restart gateway
  4. Agent attempts any exec command (e.g., echo hello)

Expected: Approval prompt appears in Control UI; command runs after approval.

Actual: Exec immediately fails with "gateway closed (1008): pairing required" before reaching the approval stage. The approval WebSocket connection to the gateway is rejected.

Workaround: Setting tools.exec.ask: "off" allows exec to function normally. The issue is specific to the approval registration WebSocket, not exec itself.

Diagnostic output:

  • openclaw gateway probe → Reachable: yes, RPC: ok
  • openclaw gateway status → Runtime: running, RPC probe: ok
  • openclaw doctor → no blocking issues
  • openclaw approvals get → file exists, socket path set, defaults configured

Fix Action

Fix / Workaround

Workaround: Setting tools.exec.ask: "off" allows exec to function normally. The issue is specific to the approval registration WebSocket, not exec itself.

Agent exec → ask: "always" → approval handler opens WebSocket to ws://127.0.0.1:18789 → gateway rejects with 1008: pairing required → no approval prompt dispatched → command never executes.

Code Example

Exec approval registration failed: Error: gateway closed (1008): pairing required
Gateway target: ws://127.0.0.1:18789
Source: local loopback

---

"tools": {
     "exec": {
       "security": "full",
       "ask": "always"
     }
   }

---

openclaw approvals set --stdin <<'EOF'
   {
     "version": 1,
     "defaults": {
       "security": "full",
       "ask": "always",
       "askFallback": "deny"
     }
   }
   EOF

---

Exec approval registration failed: Error: gateway closed (1008): pairing required
    Gateway target: ws://127.0.0.1:18789
    Source: local loopback

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Title: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway

Summary:

When tools.exec.ask is set to "always" (with security: "full"), all exec commands fail with:

Exec approval registration failed: Error: gateway closed (1008): pairing required
Gateway target: ws://127.0.0.1:18789
Source: local loopback

Environment:

  • OpenClaw 2026.4.1 (da64a97)
  • macOS 15.5 (arm64), Node 25.9.0
  • Gateway mode: local, bind: loopback
  • Auth mode: token (with valid token set)

Steps to reproduce:

  1. Set tools.exec.security: "full" and tools.exec.ask: "always" in openclaw.json
  2. Set host approvals via openclaw approvals set with defaults.ask: "always" and defaults.askFallback: "deny"
  3. Restart gateway
  4. Agent attempts any exec command (e.g., echo hello)

Expected: Approval prompt appears in Control UI; command runs after approval.

Actual: Exec immediately fails with "gateway closed (1008): pairing required" before reaching the approval stage. The approval WebSocket connection to the gateway is rejected.

Workaround: Setting tools.exec.ask: "off" allows exec to function normally. The issue is specific to the approval registration WebSocket, not exec itself.

Diagnostic output:

  • openclaw gateway probe → Reachable: yes, RPC: ok
  • openclaw gateway status → Runtime: running, RPC probe: ok
  • openclaw doctor → no blocking issues
  • openclaw approvals get → file exists, socket path set, defaults configured

Steps to reproduce

Steps to Reproduce:

  1. Fresh install OpenClaw 2026.4.1 on macOS via npm install -g openclaw@latest
  2. Run openclaw onboard --install-daemon (local mode, loopback bind, token auth)
  3. Confirm gateway is running: openclaw gateway status → Runtime: running, RPC probe: ok
  4. Set exec approval policy in ~/.openclaw/openclaw.json:
    "tools": {
      "exec": {
        "security": "full",
        "ask": "always"
      }
    }
  5. Set host-local approvals:
    openclaw approvals set --stdin <<'EOF'
    {
      "version": 1,
      "defaults": {
        "security": "full",
        "ask": "always",
        "askFallback": "deny"
      }
    }
    EOF
  6. Restart gateway: openclaw gateway restart
  7. Confirm gateway is healthy: openclaw gateway probe → Reachable: yes, RPC: ok
  8. Open Control UI at http://127.0.0.1:18789
  9. Send any message that triggers an exec tool call (e.g., "run echo hello")
  10. Observe error in agent response:
    Exec approval registration failed: Error: gateway closed (1008): pairing required
    Gateway target: ws://127.0.0.1:18789
    Source: local loopback
  11. Confirm no approval prompt appears in the Control UI
  12. Change ask to "off", restart gateway, retry — exec works normally

Expected behavior

Expected Behavior:

When tools.exec.ask is set to "always", the agent's exec command should be held in a pending state and an approval prompt should appear in the Control UI (or connected companion app), allowing the user to review the command and approve or deny it before execution. After approval, the command should execute normally and return output to the agent.

Actual behavior

Actual Behavior:

The exec command fails immediately without reaching the approval stage. The approval registration WebSocket connection to the gateway is rejected with a 1008: pairing required close code. No approval prompt is shown in the Control UI. The command never executes. This occurs on every exec attempt regardless of the command being run.

OpenClaw version

<v2026.4.1>

Operating system

macOS 15.5

Install method

No response

Model

Claude-Opus-4-6

Provider / routing chain

Agent exec → ask: "always" → approval handler opens WebSocket to ws://127.0.0.1:18789 → gateway rejects with 1008: pairing required → no approval prompt dispatched → command never executes.

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can be worked around by setting tools.exec.ask to "off" or investigating the pairing requirement for the local loopback gateway.

Guidance

  • Verify that the gateway is properly configured and running by checking the output of openclaw gateway status and openclaw gateway probe.
  • Check the approval settings in ~/.openclaw/openclaw.json and ensure that the ask and askFallback settings are correctly configured.
  • Investigate the pairing requirement for the local loopback gateway and determine why it is rejecting the approval registration WebSocket connection.
  • Consider setting up a debug log or increasing the log level to gather more information about the error.

Example

No code snippet is provided as the issue seems to be related to configuration and gateway setup.

Notes

The issue appears to be specific to the approval registration WebSocket connection and the local loopback gateway. The workaround of setting tools.exec.ask to "off" suggests that the issue is related to the approval mechanism.

Recommendation

Apply workaround: set tools.exec.ask to "off" to allow exec to function normally, and investigate the pairing requirement for the local loopback gateway to resolve the underlying 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…

FAQ

Expected behavior

Expected Behavior:

When tools.exec.ask is set to "always", the agent's exec command should be held in a pending state and an approval prompt should appear in the Control UI (or connected companion app), allowing the user to review the command and approve or deny it before execution. After approval, the command should execute normally and return output to the agent.

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]: tools.exec.ask: "always" fails with "pairing required" on local loopback gateway [1 participants]