openclaw - 💡(How to fix) Fix delivery.mode: 'announce' fails with 'No active WhatsApp Web listener' — module-scoped Map mismatch [4 comments, 4 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#50049Fetched 2026-04-08 00:59:51
View on GitHub
Comments
4
Participants
4
Timeline
6
Reactions
0
Timeline (top)
commented ×4closed ×1locked ×1

Error Message

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

  • Error persists across gateway restarts and re-authentication

Root Cause

The message tool and delivery system look up the WhatsApp Web listener from a module-scoped Map, but after bundling/chunking, multiple copies of the Map exist across chunks. The listener is registered in one chunk's Map, but the message tool looks it up in a different (empty) chunk's Map.

Fix Action

Workaround

Use systemEvent injection into the main session with sessionKey targeting the WhatsApp session. Do not use delivery.mode: "announce".

Code Example

{
  "sessionTarget": "isolated",
  "payload": { "kind": "agentTurn", "message": "test" },
  "delivery": { "mode": "announce", "channel": "whatsapp", "to": "+xxxxxxxxx" }
}

---

{
  "sessionTarget": "main",
  "sessionKey": "agent:main:whatsapp:direct:+xxxxxxxxx",
  "payload": { "kind": "systemEvent", "text": "test" }
}
RAW_BUFFERClick to expand / collapse

Bug Summary

WhatsApp proactive sends fail with "No active WhatsApp Web listener (account: default)" when using delivery.mode: "announce", while the same WhatsApp connection works fine for inbound auto-replies and systemEvent injection.

Root Cause

The message tool and delivery system look up the WhatsApp Web listener from a module-scoped Map, but after bundling/chunking, multiple copies of the Map exist across chunks. The listener is registered in one chunk's Map, but the message tool looks it up in a different (empty) chunk's Map.

Reproduction

Fails (Broken Path)

{
  "sessionTarget": "isolated",
  "payload": { "kind": "agentTurn", "message": "test" },
  "delivery": { "mode": "announce", "channel": "whatsapp", "to": "+xxxxxxxxx" }
}

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

Works (Bypass)

{
  "sessionTarget": "main",
  "sessionKey": "agent:main:whatsapp:direct:+xxxxxxxxx",
  "payload": { "kind": "systemEvent", "text": "test" }
}

Message delivers successfully via the session's active connection.

Evidence

  • Inbound auto-replies work (different code path, same WhatsApp connection)
  • Cron jobs with systemEvent + sessionTarget: "main" work
  • openclaw message send CLI consistently fails
  • Error persists across gateway restarts and re-authentication

Workaround

Use systemEvent injection into the main session with sessionKey targeting the WhatsApp session. Do not use delivery.mode: "announce".

Environment

  • OpenClaw version: 2026.3.13
  • WhatsApp: Linked and authenticated (inbound works)
  • Gateway: Running, WhatsApp Web listener active

Related

Likely same root cause as intermittent failures in sub-agent announce delivery.

extent analysis

Fix Plan

To resolve the issue, we need to ensure that the WhatsApp Web listener is registered in a single, shared Map instance across all chunks.

Here are the steps to fix the issue:

  • Create a singleton instance of the Map that stores WhatsApp Web listeners.
  • Modify the message tool and delivery system to use this singleton instance.
  • Update the listener registration code to use the singleton instance.

Example code snippet:

// Create a singleton instance of the Map
class WhatsAppListenerRegistry {
  private static instance: WhatsAppListenerRegistry;
  private listeners: Map<string, any>;

  private constructor() {
    this.listeners = new Map();
  }

  public static getInstance(): WhatsAppListenerRegistry {
    if (!WhatsAppListenerRegistry.instance) {
      WhatsAppListenerRegistry.instance = new WhatsAppListenerRegistry();
    }
    return WhatsAppListenerRegistry.instance;
  }

  public registerListener(account: string, listener: any) {
    this.listeners.set(account, listener);
  }

  public getListener(account: string) {
    return this.listeners.get(account);
  }
}

// Modify the message tool and delivery system to use the singleton instance
const registry = WhatsAppListenerRegistry.getInstance();
const listener = registry.getListener('default');

// Update the listener registration code to use the singleton instance
registry.registerListener('default', listener);

Verification

To verify that the fix worked, try sending a message using delivery.mode: "announce" and check if the message is delivered successfully. You can also check the gateway logs to ensure that the WhatsApp Web listener is registered correctly.

Extra Tips

  • Make sure to update all instances of the listener registration code to use the singleton instance.
  • Consider adding logging or monitoring to track the registration and usage of WhatsApp Web listeners.
  • Review the code for any other potential issues that may be related to the chunking and bundling process.

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

openclaw - 💡(How to fix) Fix delivery.mode: 'announce' fails with 'No active WhatsApp Web listener' — module-scoped Map mismatch [4 comments, 4 participants]