openclaw - 💡(How to fix) Fix WhatsApp proactive sends broken: requireActiveWebListener uses duplicated listeners Map [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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

Error Message

Error: No active WhatsApp Web listener (account: default).

Root Cause

The gateway's JS bundles have duplicated listeners Map instances:

  1. web-Cz_8x_nz.js imports setActiveWebListener from model-selection-CU2b7bN6.js (line 7, aliased as p) and calls it on successful WA connection (line 2009). This sets the listener in model-selection's listeners Map.

  2. However, the gateway's RPC "send" handler calls requireActiveWebListener which checks a different listeners Map — the one in discord-CcCLMjHw.js (line 155050), which has its own const listeners = new Map() (line 155043).

  3. Since the web module only sets the listener in model-selection's Map, the RPC handler's Map is always empty → proactive sends always fail.

Fix Action

Workaround

Killing the gateway, sending via direct Baileys connection, letting gateway auto-restart. Causes ~15s blip.

Code Example

Error: No active WhatsApp Web listener (account: default).
RAW_BUFFERClick to expand / collapse

Bug

Proactive WhatsApp sends via message(action=send), openclaw message send CLI, hooks/agent, and cron delivery all fail with:

Error: No active WhatsApp Web listener (account: default).

Session replies work fine. Only proactive (non-reply) sends are broken.

Environment

  • OpenClaw 2026.3.13 (61d171a)
  • Node v22.22.1
  • Linux 6.8.0 (Docker container)
  • WhatsApp channel: linked, connected, heartbeat healthy

Root Cause Analysis

The gateway's JS bundles have duplicated listeners Map instances:

  1. web-Cz_8x_nz.js imports setActiveWebListener from model-selection-CU2b7bN6.js (line 7, aliased as p) and calls it on successful WA connection (line 2009). This sets the listener in model-selection's listeners Map.

  2. However, the gateway's RPC "send" handler calls requireActiveWebListener which checks a different listeners Map — the one in discord-CcCLMjHw.js (line 155050), which has its own const listeners = new Map() (line 155043).

  3. Since the web module only sets the listener in model-selection's Map, the RPC handler's Map is always empty → proactive sends always fail.

Evidence

  • Web heartbeat confirms WA is connected: messagesHandled: 6, reconnectAttempts: 0
  • openclaw status shows: WhatsApp default: enabled, configured, linked, running, connected
  • deliverWebReply (session replies) works perfectly — uses the web module's direct socket reference
  • requireActiveWebListener (proactive sends via RPC) fails — checks the wrong Map
  • All cron jobs show lastDeliveryStatus: not-delivered
  • Verified by inspecting the bundled source: two separate const listeners = new Map() declarations in different bundle chunks

Impact

  • All proactive WhatsApp sends broken (message tool, CLI, hooks, cron delivery)
  • Automation system cannot deliver scheduled messages
  • Cron jobs cannot deliver results to users
  • Only session replies work (they bypass requireActiveWebListener)

Workaround

Killing the gateway, sending via direct Baileys connection, letting gateway auto-restart. Causes ~15s blip.

extent analysis

Fix Plan

To resolve the issue of proactive WhatsApp sends failing due to duplicated listeners Map instances, we need to ensure that the requireActiveWebListener function checks the same listeners Map instance where the setActiveWebListener function sets the listener. Here are the steps:

  • Identify and merge the duplicated listeners Map instances into a single, shared instance.
  • Update the requireActiveWebListener function to check this shared listeners Map instance.
  • Ensure that the setActiveWebListener function sets the listener in this shared listeners Map instance.

Example Code

// Create a shared listeners Map instance
const listeners = new Map();

// Update setActiveWebListener to use the shared listeners Map
function setActiveWebListener(account, listener) {
  listeners.set(account, listener);
}

// Update requireActiveWebListener to check the shared listeners Map
function requireActiveWebListener(account) {
  if (!listeners.has(account)) {
    throw new Error(`No active WhatsApp Web listener (account: ${account}).`);
  }
  return listeners.get(account);
}

Verification

To verify that the fix worked, try sending a proactive WhatsApp message using the message(action=send) command, openclaw message send CLI, or a cron job. The message should be delivered successfully without throwing the "No active WhatsApp Web listener" error.

Extra Tips

  • Make sure to update all instances of listeners Map creation to use the shared instance.
  • Consider adding logging or debugging statements to ensure that the shared listeners Map instance is being updated correctly.
  • Test the fix thoroughly to ensure that both proactive sends and session replies work as expected.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING