Skip to content

Message Keeps Pending Forever #201731

@Wissam-Elias

Description

@Wissam-Elias

Issue Description

Using specific account, the message keeps pending forever for any new chat not sent a message before:

Image

Reproduction Steps

I am not able to re produce it on another account, just on a new number account i have it.

Code Sample

async sendMessage(
    client: Client,
    phone: string,
    message: string,
    messageId: string,
    uid?: string
): Promise<void> {
    const chatId = phone.includes('@') ? phone : `${phone}@c.us`;

try {
        this.logger.log(`Sending message to ${phone}`);

// Ensure chat exists before sending
        try {
            await this.withTimeout(
                client.getChatById(chatId),
                10_000,
                `Chat lookup timed out for ${phone}`
            );
        } catch {
            this.logger.debug(`No chat found for ${phone} — creating one`);

try {
                await this.withTimeout(
                    (client as any).createChat(chatId),
                    15_000,
                    `Chat creation timed out for ${phone}`
                );

// Give WhatsApp some time to fully initialize the chat
                await new Promise(resolve => setTimeout(resolve, 1500));
            } catch (createErr) {
                this.logger.warn(
                    `Could not create chat for ${phone}: ${createErr.message}`
                );
            }
        }

const result = await this.withTimeout(
            client.sendMessage(chatId, message),
            this.TIMEOUT_SEND,
            `Message send timed out to ${phone}`
        );

this.logger.debug(`Message sent: ${result.id._serialized}`);
    } catch (error) {
        await this.handleMessageError(
            error,
            phone,
            messageId,
            undefined,
            message,
            uid
        );

throw error;
    }
}

User Setup

WhatsApp Type
Account Type WhatsApp Business
Authentication Strategy LocalAuth
WhatsApp Web Version latest
whatsapp-web.js Version latest
Environment Version
Browser Type Chromium
Browser Version 144.0.7559.96
Phone OS Version Android 11
Running OS Version Ubuntu 24
Node.js Version 22.14.0

Checklist

  • I use the latest released version of whatsapp-web.js.
  • I have searched existing issues and confirmed this is not a duplicate.
  • I have verified this is a library issue, not a problem with my code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokenissued highHigh impact issuetypingsType definitions

    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