Skip to content

Error: asUserWidOrThrow: wid is not a user wid when calling getContacts() #201717

@elhumbertoz

Description

@elhumbertoz

Issue Description

Calling client.getContacts() fails with an uncaught error: asUserWidOrThrow: wid is not a user wid. This seems to happen when the contact list contains non-user WIDs (like group JIDs) or new Linked ID (@lid) identifiers that the internal WhatsApp asUserWidOrThrow function does not validate as standard users.

Reproduction Steps

  1. Initialize the client and wait for the ready event.
  2. Call await client.getContacts().
  3. The process crashes with the following stack trace:
Error: asUserWidOrThrow: wid is not a user wid
    at s (hqMvLvPUOL4.js:79:180)
    at Object.I [as asUserWidOrThrow] (6ZCeJrDqvpN7oo8EPfVEEipN3BCR3yxG_Wl_HC4ZDPfu.js:910:3080)
    at window.WWebJS.getContactModel (pptr:evaluate;executeReadyLogic (Client.js:417:36):1030:26)
    at window.WWebJS.getContacts (pptr:evaluate;executeReadyLogic (Client.js:417:36):1082:22)

Code Sample

const contacts = await client.getContacts();
console.log(contacts);

User Setup

WhatsApp Type
Account Type WhatsApp Business
Authentication Strategy LocalAuth
WhatsApp Web Version 2.3000.1037376462
whatsapp-web.js Version 1.34.6
Environment Version
Browser Type Google Chrome
Browser Version 146.0.7680.76 (Compilación oficial) (64 bits)
Phone OS Version Android 12
Running OS Version Windows / Ubuntu 24
Node.js Version v22.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 mediumMedium impact issuetypingsType definitions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions