openclaw - 💡(How to fix) Fix [Bug]: Gateway token not auto-configured when Paperclip openclaw_gateway agents connect [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#44493Fetched 2026-04-08 00:46:06
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
1
Author
Participants
Timeline (top)
cross-referenced ×3subscribed ×1

When using Paperclip (paperclipai/paperclip) to orchestrate OpenClaw agents via the openclaw_gateway adapter, the gateway WebSocket connection fails with:

disconnected (1008): unauthorized: gateway token missing (open the dashboard URL and paste the token in Control UI settings)

This happens because:

  1. Paperclip creates agents with adapterType: "openclaw_gateway" and adapterConfig.gatewayUrl: "http://127.0.0.1:18789"
  2. The adapterConfig.headers["x-openclaw-token"] is not automatically populated during agent creation
  3. There is no UI prompt or wizard step that asks for the gateway token during Paperclip's "Hire Agent" flow
  4. The Paperclip Control UI also embeds OpenClaw's gateway status, which shows the disconnect error

Error Message

  1. The Paperclip Control UI also embeds OpenClaw's gateway status, which shows the disconnect error

Root Cause

This happens because:

  1. Paperclip creates agents with adapterType: "openclaw_gateway" and adapterConfig.gatewayUrl: "http://127.0.0.1:18789"
  2. The adapterConfig.headers["x-openclaw-token"] is not automatically populated during agent creation
  3. There is no UI prompt or wizard step that asks for the gateway token during Paperclip's "Hire Agent" flow
  4. The Paperclip Control UI also embeds OpenClaw's gateway status, which shows the disconnect error

Fix Action

Workaround

Manually update the agent's adapter_config in PostgreSQL:

UPDATE agents 
SET adapter_config = adapter_config || '{"headers": {"x-openclaw-token": "<gateway-token>"}}'::jsonb
WHERE adapter_type = 'openclaw_gateway';

Or use the tokenized URL for the Control UI: http://127.0.0.1:18789/#token=<gateway-token>

Code Example

UPDATE agents 
SET adapter_config = adapter_config || '{"headers": {"x-openclaw-token": "<gateway-token>"}}'::jsonb
WHERE adapter_type = 'openclaw_gateway';
RAW_BUFFERClick to expand / collapse

Summary

When using Paperclip (paperclipai/paperclip) to orchestrate OpenClaw agents via the openclaw_gateway adapter, the gateway WebSocket connection fails with:

disconnected (1008): unauthorized: gateway token missing (open the dashboard URL and paste the token in Control UI settings)

This happens because:

  1. Paperclip creates agents with adapterType: "openclaw_gateway" and adapterConfig.gatewayUrl: "http://127.0.0.1:18789"
  2. The adapterConfig.headers["x-openclaw-token"] is not automatically populated during agent creation
  3. There is no UI prompt or wizard step that asks for the gateway token during Paperclip's "Hire Agent" flow
  4. The Paperclip Control UI also embeds OpenClaw's gateway status, which shows the disconnect error

Workaround

Manually update the agent's adapter_config in PostgreSQL:

UPDATE agents 
SET adapter_config = adapter_config || '{"headers": {"x-openclaw-token": "<gateway-token>"}}'::jsonb
WHERE adapter_type = 'openclaw_gateway';

Or use the tokenized URL for the Control UI: http://127.0.0.1:18789/#token=<gateway-token>

Related Issues

  • #17745 — Gateway token missing on localhost
  • #26888 — "paste token in Control UI settings" but no settings exist

Expected Behavior

  1. The Paperclip "Hire Agent" form should have a visible, required field for the gateway token when adapter type is openclaw_gateway
  2. OR openclaw dashboard / openclaw doctor --generate-gateway-token should be integrated into the Paperclip onboarding flow
  3. The OpenClaw Control UI should accept the token from localStorage on WebSocket connect (not just from URL hash/query)

Environment

  • OpenClaw: 2026.3.11 (29dc654)
  • Paperclip: latest (npm exec paperclipai)
  • OS: Ubuntu Linux (VPS)
  • Gateway bind: loopback (127.0.0.1:18789)
  • Auth mode: token
  • Access: via Caddy reverse proxy (HTTPS) on custom domain

extent analysis

Fix Plan

To resolve the issue, we need to automatically populate the adapterConfig.headers["x-openclaw-token"] during agent creation in Paperclip.

Here are the steps:

  • Modify the Paperclip "Hire Agent" form to include a required field for the gateway token when the adapter type is openclaw_gateway.
  • Update the agent creation logic to populate the adapterConfig.headers["x-openclaw-token"] with the provided token.

Example code snippet:

// Hire Agent form modification
if (adapterType === 'openclaw_gateway') {
  // Add a required field for the gateway token
  const gatewayTokenField = {
    label: 'Gateway Token',
    name: 'gatewayToken',
    required: true,
  };
  // Add the field to the form
  formFields.push(gatewayTokenField);
}

// Agent creation logic modification
const agent = {
  // ... other agent properties ...
  adapterType: 'openclaw_gateway',
  adapterConfig: {
    gatewayUrl: 'http://127.0.0.1:18789',
    headers: {
      'x-openclaw-token': gatewayToken, // Populate the token from the form
    },
  },
};

Verification

To verify that the fix worked:

  • Create a new agent with the openclaw_gateway adapter type.
  • Ensure that the gateway token field is visible and required in the "Hire Agent" form.
  • Provide a valid gateway token and complete the agent creation process.
  • Check the agent's adapterConfig to ensure that the headers["x-openclaw-token"] is populated with the provided token.
  • Verify that the OpenClaw gateway WebSocket connection is established successfully.

Extra Tips

  • Consider integrating the openclaw dashboard or openclaw doctor --generate-gateway-token into the Paperclip onboarding flow to simplify the token generation process.
  • Ensure that the gateway token is stored securely and not exposed in the agent configuration or logs.

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