openclaw - 💡(How to fix) Fix WhatsApp Web listener Map duplicated across bundles — sends always fail [2 comments, 3 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#49411Fetched 2026-04-08 00:55:29
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
commented ×2labeled ×2closed ×1locked ×1

The active-listener.ts module's listeners Map is duplicated across 7+ code-split bundles. The channel plugin registers the WhatsApp Web listener in one Map, but the send handler checks a different Map — so sends always fail with "No active WhatsApp Web listener" even when the connection is up. Workaround: patch all affected dist files to use globalThis.__openclaw_wa_listeners as a shared singleton Map. Suggested fix: mark the module as a shared singleton in the bundler config. Version: 2026.3.13.

Root Cause

The active-listener.ts module's listeners Map is duplicated across 7+ code-split bundles. The channel plugin registers the WhatsApp Web listener in one Map, but the send handler checks a different Map — so sends always fail with "No active WhatsApp Web listener" even when the connection is up. Workaround: patch all affected dist files to use globalThis.__openclaw_wa_listeners as a shared singleton Map. Suggested fix: mark the module as a shared singleton in the bundler config. Version: 2026.3.13.

Fix Action

Fix / Workaround

The active-listener.ts module's listeners Map is duplicated across 7+ code-split bundles. The channel plugin registers the WhatsApp Web listener in one Map, but the send handler checks a different Map — so sends always fail with "No active WhatsApp Web listener" even when the connection is up. Workaround: patch all affected dist files to use globalThis.__openclaw_wa_listeners as a shared singleton Map. Suggested fix: mark the module as a shared singleton in the bundler config. Version: 2026.3.13.

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

The active-listener.ts module's listeners Map is duplicated across 7+ code-split bundles. The channel plugin registers the WhatsApp Web listener in one Map, but the send handler checks a different Map — so sends always fail with "No active WhatsApp Web listener" even when the connection is up. Workaround: patch all affected dist files to use globalThis.__openclaw_wa_listeners as a shared singleton Map. Suggested fix: mark the module as a shared singleton in the bundler config. Version: 2026.3.13.

Steps to reproduce

NA

Expected behavior

NA

Actual behavior

NA

OpenClaw version

above

Operating system

Ubuntu

Install method

No response

Model

sonnet 4.5

Provider / routing chain

na

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To resolve the issue of duplicated listeners Map across code-split bundles, we need to mark the active-listener.ts module as a shared singleton in the bundler config. Here are the steps:

  • Identify the bundler configuration file (e.g., webpack.config.js).
  • Add the active-listener.ts module to the list of shared modules.
  • Use a singleton instance of the Map to store listeners.

Example code snippet for Webpack:

// webpack.config.js
module.exports = {
  // ... other config options ...
  optimization: {
    splitChunks: {
      // ... other splitChunks options ...
      cacheGroups: {
        vendors: {
          test: /[\\/]node_modules[\\/]/,
          name: 'vendors',
          chunks: 'all',
        },
        activeListener: {
          test: /[\\/]active-listener\.ts[\\/]/,
          name: 'activeListener',
          chunks: 'all',
          enforce: true,
        },
      },
    },
  },
};

Alternatively, you can use the shared option in the module configuration:

// webpack.config.js
module.exports = {
  // ... other config options ...
  module: {
    // ... other module options ...
    rules: [
      {
        test: /[\\/]active-listener\.ts[\\/]/,
        use: {
          loader: 'singleton-loader',
          options: {
            name: 'activeListener',
          },
        },
      },
    ],
  },
};

Verification

To verify that the fix worked, check the following:

  • The active-listener.ts module is only instantiated once across all code-split bundles.
  • The Map instance is shared among all bundles, and listeners are correctly registered and retrieved.

You can add logging or debugging statements to the active-listener.ts module to verify that it is only instantiated once and that the Map instance is shared correctly.

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

NA

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 WhatsApp Web listener Map duplicated across bundles — sends always fail [2 comments, 3 participants]