Skip to content

deleteAddressbookContact() throws TypeError: Cannot read properties of undefined (reading 'isLid') #5669

@haishengyang

Description

@haishengyang

Is there an existing issue for this?

  • I have searched the existing issues.

Is this a problem caused by your code, or is it specifically because of the library?

  • I have double-checked my code carefully.

Describe the bug.

When calling client.deleteAddressbookContact() with a phone number in plain numeric format, the method throws a TypeError attempting to read the isLid property from an undefined object.

Expected Behavior

The method should successfully delete the contact from the addressbook, or at minimum provide a clear error message if the phone number format is invalid.

Steps to Reproduce the Bug or Issue

Environment

  • whatsapp-web.js version: v1.34.3 (from GitHub: github:pedroslopez/whatsapp-web.js#v1.34.3)
  • Node.js version: v22.16.0
  • Operating System: Windows、Linux
  1. Initialize a WhatsApp client using whatsapp-web.js
  2. Call client.deleteAddressbookContact() with a plain numeric phone number (e.g., "1234567890")
  3. The error occurs consistently every time

Code Example:
const client = new Client({
authStrategy: new RemoteAuth({
clientId: ${clientId},
// ... other config
})
});

await client.initialize();

// This throws an error
await client.deleteAddressbookContact("1234567890");

WhatsApp Account Type

Standard

Browser Type

Chromium

Operation System Type

Windows、Linux

Phone OS Type

IOS

WhatsApp-Web.js Version

1.34.3

WhatsApp Web Version

2.3000.1031077521

Node.js Version

v22.16.0

Authentication Strategy

RemoteAuth

Additional Context

According to the JSDoc comment in Client.js:2427, the expected phone number format is: "17182222222" (where "1" is a country code). However:

  1. Multiple formats tested and all fail:
    - Plain numeric format: "1234567890" ❌ Fails
    - WhatsApp ID format: "[email protected]" ❌ Also fails with the same error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions