Skip to content

[WEBJS] - Error: No LID for user #1881

@yanmcs

Description

@yanmcs

Describe the bug

When requesting messages from a specific chat via the API, the server returns a 500 Internal Server Error.
The error originates from the WEBJS engine (whatsapp-web.js) while trying to evaluate code in the browser context. The root exception is:

Error: No LID for user

This happens during getChatByIdgetChatMessages, which suggests the chat exists by JID, but WhatsApp Web fails to resolve the internal LID (Local ID) for that user, causing Puppeteer’s evaluate() to crash.


Version

{
  "version": "2026.2.1",
  "engine": "WEBJS",
  "tier": "CORE",
  "browser": "/usr/bin/chromium",
  "platform": "linux/x64",
  "worker": {
    "id": null
  }
}

Using the latest version of WEBJS, same API call in GOWS works fine.


Steps to Reproduce

  1. Start WAHA with the WEBJS engine.
  2. Ensure the WhatsApp session is authenticated and running.
  3. Send a GET request to retrieve messages from a direct chat using a @c.us JID.
  4. Include downloadMedia=true in the query.
  5. The API responds with HTTP 500.

Expected behavior

The API should return the last messages from the specified chat, or an empty array, or at minimum respond with a controlled error (e.g. 404 or 422) if the chat cannot be resolved, instead of crashing with a 500 due to a missing LID.


Requests – Responses

Request

GET /api/default/chats/57XXXXXXXXXX@c.us/messages?limit=30&downloadMedia=true

Response

HTTP 500
{
  "statusCode": 500,
  "timestamp": "2026-02-02T15:12:59.814Z",
  "exception": {
    "name": "Error",
    "message": "No LID for user",
    "stack": "Error: No LID for user\n at ExecutionContext.evaluate ..."
  }
}

Docker Logs

The error is visible in container logs and includes a Puppeteer stack trace pointing to:

  • ExecutionContext.evaluate
  • Client.getChatById
  • WhatsappSessionWebJSCore.getChatMessages

No container crash or restart occurs, only the request fails.


Screenshots

Not applicable. The issue is reproducible via API request and visible in logs.


Additional context

  • The issue occurs with direct chats (@c.us)
  • The number is valid and reachable in WhatsApp.
  • There is no chat history with the number in the chats, but it doesn't happen to all requests where there is no chat history available, sometimes it return fine just an empty array.
  • The session is authenticated and functional.
  • This appears related to recent WhatsApp Web internal changes where some users no longer expose a resolvable LID, causing whatsapp-web.js to fail during evaluation.
  • Likely requires defensive handling in getChatById when lid is missing instead of throwing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions