Skip to content

[Bug]: WhatsApp Baileys: 499 reconnect loop — idle timer not resetting on reconnect #60337

@aaronho838

Description

@aaronho838

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

WhatsApp Baileys 499 reconnect loop becomes self-sustaining because the idle message timer does not reset on successful reconnect.

Steps to reproduce

  1. Run OpenClaw with WhatsApp Baileys plugin
  2. Wait for a period of 30+ minutes with no inbound WhatsApp messages
  3. When a natural 499 disconnect occurs during this quiet period, observe:
    • 499 disconnects repeat every ~63 seconds
    • "No messages received in Xm" timer appears starting at 30m, incrementing each cycle
    • Loop does not self-resolve without an inbound message

Expected behavior

After a successful reconnect (Retry 1/12 succeeds), the idle message timer should reset to 0. The 30-minute idle threshold should count from last successful connection, not last received message. An inbound message does break the loop — confirming the timer resets on message receipt but not on reconnect.

Actual behavior

Idle timer does not reset on reconnect — only on receiving an actual message. The idle timer threshold is 30 minutes. Once triggered, it fires every reconnect cycle (~63s), compounding with 499 reconnects. Observed 90+ min / 60+ disconnects requiring manual gateway restart. Logs show: "No messages received in 30m... 31m... 32m..." incrementing by 1 min per cycle. On days with sustained activity: 127-130 total 499 events across multiple bursts.

OpenClaw version

2026.3.23-2

Operating system

Ubuntu 24.04

Install method

No response

Model

Claude Opus 4.6

Provider / routing chain

WhatsApp Baileys (bundled @whiskeysockets/baileys) → WhatsApp Web WebSocket → WhatsApp servers. No proxy or gateway between. Direct connection from AWS arm64 instance.

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclose:duplicateClosed as duplicatededupe:childDuplicate issue/PR child in dedupe cluster

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions