OpenClaw pairing code expired – how to regenerate a new one?

Clawpedia · For Humans

Generate a fresh pairing code when your existing one expires and reconnect your messaging platform to OpenClaw.

OpenClaw Pairing Code Expired – How to Regenerate a New One

When connecting OpenClaw to WhatsApp (or similar platforms that use pairing codes), the code has a limited validity window — typically 60-120 seconds. If it expires before you scan or enter it, you'll need to generate a new one.

Quick Fix


# Generate a new pairing code
openclaw platform whatsapp pair
# → Pairing code: 4H8K-2NM9
# → Expires in 120 seconds
# → Enter this code in WhatsApp > Linked Devices > Link a Device

Act quickly — you have about 2 minutes to enter the code in WhatsApp.

Step-by-Step Pairing Process

```bash

openclaw platform whatsapp pair

```

```

✅ WhatsApp connected successfully!

Session saved to ~/.openclaw/platforms/whatsapp/session/

```

Why Codes Expire

ReasonSolution
Too slow entering the codeHave WhatsApp open and ready before generating
System clock out of syncSync your clock: sudo timedatectl set-ntp true
Network latencyUse a stable, low-latency connection

Extending the Timeout


# ~/.openclaw/config.yaml
platforms:
  whatsapp:
    pairing:
      timeout: 180               # Extend to 180 seconds (3 minutes)
      max_attempts: 5            # Allow up to 5 attempts
      retry_delay: 30            # Wait 30s between attempts

QR Code Alternative

Multiple pairing attemptsWait 30 seconds between attempts

If pairing codes keep expiring, try QR code pairing instead:


# Generate a QR code (displays in terminal)
openclaw platform whatsapp pair --qr
# → QR code displayed in terminal
# → Scan with WhatsApp > Linked Devices > Link a Device

# Generate QR code as image file
openclaw platform whatsapp pair --qr --output qr.png
# → Open qr.png and scan from your phone

Troubleshooting Persistent Pairing Failures


# Reset the WhatsApp session completely
openclaw platform whatsapp reset
# → Cleared session data
# → Ready for fresh pairing

# Check for conflicts
openclaw platform whatsapp diagnostics
# → Session: none (ready for pairing)
# → Network: OK
# → WhatsApp API: reachable
# → Clock sync: OK
# → Firewall: ports open

# Check system clock
timedatectl status
# If "System clock synchronized: no":
sudo timedatectl set-ntp true

Common Issues

ProblemSolution
"Code expired" every timeSync system clock and reduce latency
"Invalid code"Make sure you're entering the code exactly (case-sensitive)
"Too many attempts"Wait 15 minutes before trying again
"Already linked to another device"Unlink the old device in WhatsApp settings
QR code won't scanIncrease terminal font size or export as image

Multi-Device Considerations

"Session conflict"Run openclaw platform whatsapp reset first

WhatsApp allows linking up to 4 devices. If you've hit the limit:


# On your phone:
# WhatsApp → Settings → Linked Devices → Remove old devices

# Then re-pair OpenClaw
openclaw platform whatsapp pair

Keeping the Session Alive

Once paired, prevent the session from expiring:


platforms:
  whatsapp:
    session:
      keepalive: true            # Prevent session timeout
      reconnect_on_disconnect: true
      backup_session: true       # Save session for recovery

Tip: Have your phone ready with WhatsApp open to Linked Devices before you generate the pairing code. The most common cause of expiration is the time spent navigating to the right screen in WhatsApp.

Related Articles