OpenClaw error: gateway connect failed, pairing required
This error means the gateway is running and reachable, but it does not trust the client that just connected. Nothing is broken. The device simply has no approved identity yet, and there are four different reasons that can happen.
The full message usually looks like one of these:
gateway connect failed: GatewayClientRequestError: pairing required
error gateway connect failed: pairing required
device identity required
All three mean the same thing. Your client reached the OpenClaw gateway, the gateway answered, and the gateway refused to act because it does not recognise the device asking. This is a trust problem, not a connectivity problem, which is why restarting the gateway almost never helps.
First, confirm the gateway is actually healthy
Before changing anything, rule out the simpler failure:
openclaw status
openclaw health
If those come back clean, the gateway is fine and you are in the right article. If they fail, you have a different problem and pairing is a red herring.
Cause 1: the device was never approved
This is the common case, and it is a thirty-second fix. On the machine running the gateway:
openclaw devices list
openclaw devices approve <id>
Then reconnect the client. If you are pairing a messaging channel rather than a device, the equivalent commands are:
openclaw pairing list whatsapp
openclaw pairing approve whatsapp <code> --notify
Pairing codes are eight characters and they expire, so list them fresh rather than reusing a code from an old terminal window.
Cause 2: a reverse proxy is hiding the fact that the request is local
This one costs people hours, because everything looks correctly configured.
The gateway auto-approves requests that it can see are coming from the local
machine. It decides that by looking at the incoming request. Put nginx, Caddy, or
any other reverse proxy in front of it with the usual defaults, and the proxy
rewrites the Host header and adds X-Forwarded-For and
X-Real-IP. From the gateway's point of view the request is now
arriving from somewhere else, so it stops auto-approving and demands pairing.
The fix is to make the proxied request look local again. In the proxy block that
forwards to the gateway, set the host header to localhost and do not
forward the client IP headers:
proxy_set_header Host "localhost";
# and deliberately do NOT set X-Forwarded-For or X-Real-IP here
If you deliberately want remote access with real pairing, leave the headers alone and approve the device instead. Just be aware which of the two you chose.
Cause 3: the dashboard is being served over plain HTTP
Browser device identity is generated with the WebCrypto API, and browsers only
expose WebCrypto on a secure context. Over http:// on anything other
than localhost, the browser cannot create the key, so the dashboard has no identity
to present and the gateway asks for pairing that can never complete.
The proper fix is to serve the dashboard over HTTPS. If you are testing on a
trusted local network and accept the risk, the gateway config accepts
allowInsecureAuth: true as a temporary escape hatch. Do not leave that
on for anything reachable from the internet.
Cause 4: the gateway token does not match
If your client passes a token, a mismatch surfaces as a pairing or unauthorized
error rather than a clear "wrong token" message. Related errors you may see are
gateway token missing and unauthorized gateway token mismatch.
Check that OPENCLAW_GATEWAY_TOKEN is set to the same value on both
sides, and remember that the env var has to be visible to the process, not just to
your login shell. A token exported in .bashrc is invisible to a systemd
unit.
Quick reference
| Symptom | Most likely cause |
|---|---|
| Fresh install, first connection | Device never approved |
| Works locally, fails through nginx or Caddy | Proxy headers |
| Fails only in the browser, CLI is fine | No HTTPS, WebCrypto blocked |
| Started after a token rotation | Token mismatch |
| Started after restoring a backup | Stale device identity, re-approve |
Where the identity actually lives
Paired node tokens are stored in ~/.openclaw/nodes/paired.json. That
file holds credentials, so it should be chmod 600. If you are moving a
gateway between machines and want the pairings to come with it, that is the file to
carry across, along with the rest of ~/.openclaw.
Frequently asked questions
- Does this error mean the gateway is down?
- No. The connection reached the gateway and the gateway answered. A gateway that is down produces a connection refused or a timeout, not a pairing error.
- Why did it work yesterday and not today?
- Device identities are stored in ~/.openclaw/nodes/paired.json and in the browser. Clearing browser storage, reinstalling, restoring a machine from backup, or rotating the gateway token all invalidate the identity.
- Can I disable pairing entirely?
- You can, but do not. Pairing is what stops anyone who can reach port 18789 from driving your agent. Approve the device instead.
Related guides
- Where is the OpenClaw config file, and how do you change its location?The short answer is ~/.openclaw/openclaw.json, written in JSON5. The longer answer matters when your edits appear to be ignored, which is almost always a second config file or an environment variable winning over the one you edited.
- OpenClaw error: API rate limit reached, please try again laterThe single most useful thing to know about this error is that OpenClaw did not produce it. It is relaying a 429 from whichever model provider it was calling, so the fix is on the provider side or in how hard OpenClaw is hitting it.
- OpenClaw Gateway Token Missing or Unauthorized? Read the Detail Code FirstOpenClaw returns one of five auth detail codes when a gateway connection is refused, and each one needs a different fix. This guide maps AUTH_TOKEN_MISSING, AUTH_TOKEN_MISMATCH, AUTH_DEVICE_TOKEN_MISMATCH, AUTH_SCOPE_MISMATCH and PAIRING_REQUIRED to the exact commands that clear them.
- How to Fix "Hermes backend exited before it became ready"The number in the brackets decides everything. Zero means a healthy backend shut itself down, usually a Windows watchdog misfire, and any other number means it genuinely failed, usually an update applied while Hermes was still running.
