The Problem
You scan the WhatsApp QR code successfully, but the connection gets stuck at "logging in" and never completes. This is one of the most reported issues in the OpenClaw community.
Why This Happens
Connection Timeout Issue
The waitForWaConnection() function waits for a WhatsApp socket to reach "open" or "close" state, but has no timeout. If the connection enters an intermediate state (perpetual reconnecting, limbo), the promise hangs forever.
Symptoms:
Competing Sessions
If you previously linked a different number and are trying to switch:
Solutions
Solution 1: Clear WhatsApp Credentials
# Stop the gateway
openclaw gateway stop# Remove WhatsApp credentials
rm -rf ~/.openclaw/credentials/whatsapp
# Restart and try again
openclaw gateway start
openclaw channels login whatsapp
Solution 2: Use Pairing Code Method
Instead of QR code scanning, use the phone number pairing method:
openclaw channels login whatsapp --method pairing-codeThis generates a 6-digit code you enter in WhatsApp's "Link with phone number" option.
Solution 3: Check Network Connectivity
Ensure your network allows WebSocket connections:
# Test WhatsApp connectivity
curl -I https://web.whatsapp.comSome networks block WhatsApp WebSocket traffic. Try:
Solution 4: Verbose Logging
Enable detailed logging to diagnose the issue:
openclaw channels login whatsapp --verboseLook for:
Prevention Tips
openclaw channels status --probe regularlyStill Stuck?
If the connection continues to hang, contact our team for hands-on troubleshooting assistance.