Skip to content

[Bug]: WhatsApp provider enters infinite retry loop on status 440 (session conflict) #25591

@arosstale

Description

@arosstale

Summary

WhatsApp Web provider enters an infinite retry loop on status 440 ("Unknown Stream Errored (conflict)"). The loop retries 12 times with exponential backoff capped at 30s, exhausts retries, then auto-restarts and repeats indefinitely. The health-monitor also triggers restarts for "stuck" state, resetting the retry counter and prolonging the loop.

This floods the gateway log (~2 lines/second), wastes CPU, and masks other log entries.

Environment

  • OS: Windows 11 (26200.7840)
  • OpenClaw: 2026.2.23 (b817600)
  • Install method: Pinokio
  • Node: v22.22.0

Steps to Reproduce

  1. Configure WhatsApp channel with a valid phone number
  2. Start gateway (openclaw gateway run)
  3. WhatsApp Web connection fails with status 440
  4. Observe the retry loop in logs

Actual Behavior

11:30:48 [whatsapp] Listening for personal WhatsApp inbound messages.
11:30:53 [whatsapp] Web connection closed (status 440). Retry 2/12 in 4.46s… (status=440 Unknown Stream Errored (conflict))
11:30:59 [whatsapp] Listening for personal WhatsApp inbound messages.
11:31:07 [whatsapp] Web connection closed (status 440). Retry 3/12 in 7.01s… (status=440 Unknown Stream Errored (conflict))
...
11:38:48 [whatsapp] Web reconnect: max attempts reached (12/12). Stopping web monitoring.
11:38:48 [whatsapp] [default] auto-restart attempt 1/10 in 5s
11:38:53 [whatsapp] [default] starting provider (+39344XXXXXXX)
11:38:55 [whatsapp] Listening for personal WhatsApp inbound messages.
11:38:58 [whatsapp] Web connection closed (status 440). Retry 1/12 in 2.4s…

The cycle repeats: 12 retries → auto-restart (up to 10 times) → health-monitor restart ("stuck") → 12 retries again. Observed continuously for 30+ minutes with no recovery.

Expected Behavior

After exhausting retries, the provider should:

  1. Stop retrying and log an error once (not restart indefinitely)
  2. Or: detect that status 440 is a persistent/auth failure (not transient) and fail fast instead of retrying 12 × 10 × health-monitor restarts

Additional Context

Status 440 appears to mean a session conflict (another client connected to the same WhatsApp Web session). This is not a transient network error — retrying will never fix it. The provider should distinguish between transient errors (network timeout) and persistent errors (auth conflict, session expired) and fail fast on the latter.

The health-monitor compounds the problem by restarting the provider for being "stuck", which just resets the retry counter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions