Skip to content

[BUG] Repeated "disconnect_reason": "Too many reconnect attempts: 428|close" causing constant restarts #2249

Description

@tomiheneldra

Describe the bug
After scanning QR and successfully connecting, the bot runs normally for several minutes to hours. Then, it suddenly disconnects with the error "disconnect_reason": "Too many reconnect attempts: 428|close" and enters a restart loop, reconnecting and quickly disconnecting again with the same 428 error. This has been occurring persistently for the past day.

To Reproduce
Steps to reproduce the behavior:

  1. Start the client using Baileys with saved credentials or fresh QR scan.
  2. The connection establishes successfully and the bot functions normally.
  3. After an unpredictable period (minutes to hours), the connection drops.
  4. The client attempts to reconnect automatically but fails repeatedly with error code 428.
  5. The cycle of reconnect -> 428 error -> disconnect continues indefinitely.

Expected behavior
The client should either:

  • Reconnect successfully and resume normal operation after a temporary disconnect, or
  • Fail clearly without entering an infinite restart loop.

A 428 error ("Too many reconnect attempts") should not trigger continuously after a single successful connection session.

Environment :

  • Is this on a server? Yes
  • What do your connectOptions look like?
const client = makeWASocket({
        logger: pino({
            level: "silent"
        }),
        version: waVersion, // [2, 3000, 1030831524]
        auth: state,
        browser: [ "Chrome", "Windows", "124.0.6367.207" ],
        defaultQueryTimeoutMs: 60000,
        syncFullHistory: false,
        shouldSyncHistoryMessage: () => false,
        online: false,
        markOnlineOnConnect: false,
        connectTimeoutMs: 60000,
        keepAliveIntervalMs: 60000,
        qrTimeout: 60000,
        retryRequestDelayMs: 1000 + Math.floor(Math.random() * 2000), // delay random
        generateHighQualityLinkPreview: false,
        getMessage: async (key) => {
            const msg = store.loadMessage(key.remoteJid, key.id);
            return msg?.message || { conversation: '' };
        },
        patchMessageBeforeSending: async (msg, recipientJids) => {
            await client.uploadPreKeysToServerIfRequired();
            return msg;
        }
        }
    });

Additional context :

  • Baileys version: 7.0.0-rc.9 (latest from npm)
  • This issue started occurring approximately 24 hours ago. Prior to this, the same code/configuration ran stably for extended periods.
  • The error appears to be triggered by WhatsApp's server-side enforcement (428 is likely a custom WhatsApp protocol error), not directly by local network issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions