-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
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 getChatById → getChatMessages, 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
- Start WAHA with the WEBJS engine.
- Ensure the WhatsApp session is authenticated and running.
- Send a GET request to retrieve messages from a direct chat using a
@c.usJID. - Include
downloadMedia=truein the query. - 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.evaluateClient.getChatByIdWhatsappSessionWebJSCore.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.jsto fail during evaluation. - Likely requires defensive handling in
getChatByIdwhenlidis missing instead of throwing.