-
-
Notifications
You must be signed in to change notification settings - Fork 52.9k
Description
Summary
When the WhatsApp Web listener encounters a DNS or network error (ENOTFOUND web.whatsapp.com) during the initial connection attempt in monitorWebChannel, the error escapes the reconnect loop entirely. The gateway process keeps running but the WhatsApp channel remains dead until a manual restart.
This is distinct from mid-session disconnects (which are handled by the existing reconnect/backoff logic). The bug is specifically that the first await listenerFactory() call in monitorWebChannel (src/web/auto-reply/monitor.ts) has no error handling — if it throws, the entire channel monitor exits.
Root Cause
In src/web/auto-reply/monitor.ts, the reconnect loop calls await listenerFactory() without a try/catch. When this initial call fails (e.g., DNS resolution error), the error propagates up and exits monitorWebChannel. The existing backoff/retry logic only kicks in for subsequent disconnects (via listener.onClose), not for failures during initial startup.
Environment
- OpenClaw version: 2026.2.3 (confirmed), likely affects all versions
- Node version: v25.2.1
- OS: macOS Darwin 25.2.0 (arm64)
- Channel: WhatsApp Web (Baileys)
Steps to Reproduce
- Start the OpenClaw gateway with WhatsApp Web configured
- Ensure DNS resolution for
web.whatsapp.comfails during startup (e.g., disconnect network briefly, or poison DNS) - Observe that the channel monitor exits and does not retry
Expected Behavior
Initial connection failures should be caught and retried using the same backoff/maxAttempts logic as reconnects after mid-session disconnects.
Actual Behavior
The channel monitor exits silently. Logs show:
{"error":"Error: getaddrinfo ENOTFOUND web.whatsapp.com"},"WebSocket error"
No reconnect attempt is made. The channel stays dead until manual openclaw gateway restart.
Log Evidence (production, 2026-02-05)
path: "opt/homebrew/lib/node_modules/openclaw/dist/web/session.js:117"
time: "2026-02-05T07:16:14.679Z"
{"error":"Error: getaddrinfo ENOTFOUND web.whatsapp.com"},"WebSocket error"
Channel remained dead from 07:16 UTC until manual restart at 13:06 UTC (~6 hours of downtime).
Related
- [Bug]: WhatsApp gateway fails to reconnect after DNS resolution failure #2198 (same symptom, now closed)
- PR fix(whatsapp): retry reconnect loop on initial connection failure #9727 contains the fix and a regression test