openclaw - 💡(How to fix) Fix WhatsApp Web listener silently dies after health-monitor stale-socket restart [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#49969Fetched 2026-04-08 01:00:46
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1

The WhatsApp health monitor's stale-socket restart cycle reliably re-establishes the personal/inbound listener but silently fails to reconnect the Web listener (used for all proactive outbound sends). This causes all outbound WhatsApp messaging — cron deliveries, message tool sends, announce-mode delivery — to fail with:

No active WhatsApp Web listener (account: default). Start the gateway, then link WhatsApp with: openclaw channels login --channel whatsapp --account default.

Meanwhile, inbound DMs continue to work normally (personal listener is fine), masking the failure.

Root Cause

  1. openclaw channels status reports "connected" even when Web listener is down: status check shows linked, running, connected because the personal listener is fine. No way to distinguish from the outside.

Fix Action

Workaround

Full stop → credential wipe → fresh QR scan → start. Lasts 12–30 hours before the cycle repeats.

openclaw gateway stop
mv ~/.openclaw/credentials/whatsapp/default ~/.openclaw/credentials/whatsapp/default.bak
openclaw channels login --channel whatsapp --account default  # scan QR
openclaw gateway start

Code Example

No active WhatsApp Web listener (account: default). Start the gateway, then link WhatsApp with: openclaw channels login --channel whatsapp --account default.

---

Mar 16 14:07:43 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 16 14:07:44 [whatsapp] Listening for personal WhatsApp inbound messages.

---

Mar 16 14:14:47 [whatsapp] Web connection closed (status 440: session conflict). Stopping web monitoring.
Mar 16 14:14:47 [whatsapp] [default] auto-restart attempt 1/10 in 5s
Mar 16 14:14:53 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 16 14:14:53 [whatsapp] Listening for personal WhatsApp inbound messages.

---

Mar 17 14:03:44 [whatsapp] No messages received in 30m - restarting connection
Mar 17 14:03:44 [whatsapp] Web connection closed (status 499). Retry 1/12 in 2.33s…
Mar 17 14:03:47 [whatsapp] Listening for personal WhatsApp inbound messages.

---

Mar 17 21:17:43 [health-monitor] [whatsapp:default] health-monitor: restarting (reason: stale-socket)
Mar 17 21:17:43 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 17 21:17:45 [whatsapp] Listening for personal WhatsApp inbound messages.

---

Mar 18 09:37:37 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 18 09:37:37 [delivery-recovery] Retry failed: No active WhatsApp Web listener
Mar 18 09:37:37 [whatsapp] Listening for personal WhatsApp inbound messages.

---

openclaw gateway stop
mv ~/.openclaw/credentials/whatsapp/default ~/.openclaw/credentials/whatsapp/default.bak
openclaw channels login --channel whatsapp --account default  # scan QR
openclaw gateway start
RAW_BUFFERClick to expand / collapse

Summary

The WhatsApp health monitor's stale-socket restart cycle reliably re-establishes the personal/inbound listener but silently fails to reconnect the Web listener (used for all proactive outbound sends). This causes all outbound WhatsApp messaging — cron deliveries, message tool sends, announce-mode delivery — to fail with:

No active WhatsApp Web listener (account: default). Start the gateway, then link WhatsApp with: openclaw channels login --channel whatsapp --account default.

Meanwhile, inbound DMs continue to work normally (personal listener is fine), masking the failure.

Environment

  • OpenClaw version: 2026.3.13
  • OS: Ubuntu Linux 6.17.0-14-generic (x64)
  • Node: v25.6.1
  • WhatsApp setup: Dedicated number (+1XXXXXXXXXX), Baileys Web channel, single default account

Reproduction pattern

This has occurred three times with the same sequence:

  1. Fresh openclaw channels login + gateway start → both personal and Web listeners come up → outbound sends work ✓
  2. Health monitor fires stale-socket restart every ~35 minutes continuously
  3. After 12–30 hours, one of these restarts reconnects the personal listener but does not reconnect the Web socket
  4. All subsequent outbound sends fail; inbound DMs still work
  5. Only fix is full credential wipe + re-link QR scan

Dates observed: March 4, March 16, March 18, 2026 — same pattern each time.

Log evidence (PID 17871, Mar 16–18)

Startup — personal listener comes up, Web listener is absent

Mar 16 14:07:43 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 16 14:07:44 [whatsapp] Listening for personal WhatsApp inbound messages.

No corresponding "Web listener" log line. Outbound sends immediately fail.

440 conflict accidentally fixes it

Mar 16 14:14:47 [whatsapp] Web connection closed (status 440: session conflict). Stopping web monitoring.
Mar 16 14:14:47 [whatsapp] [default] auto-restart attempt 1/10 in 5s
Mar 16 14:14:53 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 16 14:14:53 [whatsapp] Listening for personal WhatsApp inbound messages.

After this auto-restart, sends start working (first successful send at 14:15:12). The 440 recovery path appears to properly re-establish both connections.

499/503 restarts — Web listener survives these

Mar 17 14:03:44 [whatsapp] No messages received in 30m - restarting connection
Mar 17 14:03:44 [whatsapp] Web connection closed (status 499). Retry 1/12 in 2.33s…
Mar 17 14:03:47 [whatsapp] Listening for personal WhatsApp inbound messages.

Sends continue working after 499/503 restarts (confirmed sends at 15:10, 19:03, 20:47).

Health monitor stale-socket restart — kills Web listener

Mar 17 21:17:43 [health-monitor] [whatsapp:default] health-monitor: restarting (reason: stale-socket)
Mar 17 21:17:43 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 17 21:17:45 [whatsapp] Listening for personal WhatsApp inbound messages.

These fire every ~35 minutes. At some point overnight, one of these restarts fails to bring back the Web socket. By 08:20 Mar 18, all outbound sends fail.

Fresh gateway restart does NOT fix it

Mar 18 09:37:37 [whatsapp] [default] starting provider (+1XXXXXXXXXX)
Mar 18 09:37:37 [delivery-recovery] Retry failed: No active WhatsApp Web listener
Mar 18 09:37:37 [whatsapp] Listening for personal WhatsApp inbound messages.

Full openclaw gateway restart (new PID 607329) — personal listener comes up, Web listener does not.

Key observations

  1. Two separate connection paths: personal listener (inbound DMs/auto-replies) and Web listener (outbound proactive sends) are independent. The health monitor only reliably restarts the personal one.

  2. The 440 recovery path works: when a session conflict triggers auto-restart, both listeners come back. The stale-socket restart path does not have the same behavior.

  3. openclaw channels login while gateway is running causes 440 conflicts: running it against a live gateway creates competing Web sessions, making things worse.

  4. openclaw channels status reports "connected" even when Web listener is down: status check shows linked, running, connected because the personal listener is fine. No way to distinguish from the outside.

Expected behavior

  • Health monitor stale-socket restart should re-establish both the personal listener and Web listener
  • openclaw channels status should separately report personal vs Web listener state
  • Gateway restart with valid saved credentials should bring up the Web listener without requiring a fresh QR scan

Workaround

Full stop → credential wipe → fresh QR scan → start. Lasts 12–30 hours before the cycle repeats.

openclaw gateway stop
mv ~/.openclaw/credentials/whatsapp/default ~/.openclaw/credentials/whatsapp/default.bak
openclaw channels login --channel whatsapp --account default  # scan QR
openclaw gateway start

extent analysis

Fix Plan

To address the issue of the WhatsApp Web listener not reconnecting after a health monitor stale-socket restart, we need to modify the restart logic to ensure both personal and Web listeners are re-established. Here are the steps:

  • Modify the health monitor script to restart both listeners:
// In health-monitor.js
const restartListeners = async () => {
  // Restart personal listener
  await restartPersonalListener();
  
  // Restart Web listener
  await restartWebListener();
};

const restartPersonalListener = async () => {
  // Existing logic to restart personal listener
};

const restartWebListener = async () => {
  // New logic to restart Web listener
  // This may involve re-authenticating with WhatsApp and re-establishing the Web socket
};
  • Update the openclaw channels status command to report separate states for personal and Web listeners:
// In channels-status.js
const getStatus = async () => {
  const personalListenerStatus = await getPersonalListenerStatus();
  const webListenerStatus = await getWebListenerStatus();
  
  return {
    personalListener: personalListenerStatus,
    webListener: webListenerStatus,
  };
};
  • Ensure that the gateway restart logic brings up the Web listener without requiring a fresh QR scan:
// In gateway.js
const startGateway = async () => {
  // Existing logic to start gateway
  
  // Restart Web listener if it's not already connected
  if (!webListenerConnected) {
    await restartWebListener();
  }
};

Verification

To verify that the fix worked, restart the gateway and health monitor, and then check the status of both listeners using openclaw channels status. The Web listener should now be reported as connected, and outbound sends should succeed.

Extra Tips

  • Make sure to test the modified health monitor script and gateway restart logic thoroughly to ensure that both listeners are re-established correctly.
  • Consider adding additional logging to help diagnose any future issues with the listeners.
  • Review the WhatsApp documentation to ensure that the re-authentication logic for the Web listener is correct and compliant with their requirements.

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…

FAQ

Expected behavior

  • Health monitor stale-socket restart should re-establish both the personal listener and Web listener
  • openclaw channels status should separately report personal vs Web listener state
  • Gateway restart with valid saved credentials should bring up the Web listener without requiring a fresh QR scan

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING