GitHub Issue — devlikeapro/waha
Title: [BAILEYS][Chatwoot App] readMessages on @lid chats routes to WEBJS getChat → 500, blocks outbound send
Description
Environment
- WAHA version: 2026.5.1 (
GET /api/version or error payload version.version)
- Image:
devlikeapro/waha:latest (digest truncated)
- Engine:
WHATSAPP_DEFAULT_ENGINE=BAILEYS
- WAHA Apps:
WAHA_APPS_ON=chatwoot
- Platform: linux/x64, tier CORE
Steps to reproduce
- Run WAHA with BAILEYS engine and Chatwoot app enabled (inbox API channel).
- Ensure a Chatwoot contact has
custom_attributes.wa_lid (e.g. {numeric_id}@lid) — normal for WhatsApp privacy / Linked ID.
- Create an outgoing message in Chatwoot inbox (or via API) so
ChatWootInboxMessageCreatedConsumer runs.
- Observe job
chatwoot.inbox | message_created fail after 3 retries.
Expected behavior
sendTextMessage should deliver to WhatsApp even if mark-as-read fails, or
readMessages on BAILEYS session should use Baileys implementation, not WEBJS.
Actual behavior
MessageHandler.sendTextMessage calls await session.readMessages(chatId) before sendText:
// /app/dist/apps/chatwoot/consumers/inbox/message_created.js (~line 163)
await session.readMessages(chatId);
await session.startTyping(...);
const msg = await session.sendText(request);
For @lid chat IDs, internal API call fails:
POST /api/default/chats/{lid}@lid/messages/read
→ 500 TypeError: Cannot read properties of undefined (reading 'getChat')
Stack trace shows WEBJS path while session reports BAILEYS:
WhatsappSessionWebJSCore.readChatMessages (session.webjs.core.js:608)
WebjsClientCore.getChatById (whatsapp-web.js Client.js:1171)
WPage.evaluate (webjs/WPage.js:13)
Version block in error JSON:
"version": { "version": "2026.5.1", "engine": "BAILEYS", "tier": "CORE" }
Outbound WhatsApp messages never send because the exception aborts before sendText.
Workaround (local patch)
Wrap readMessages in try/catch in message_created.js so send proceeds:
try { await session.readMessages(chatId); } catch (e) { this.logger.warn(`Skip readMessages: ${e?.message}`); }
Suggested fix (upstream)
- Implement
readChatMessages for BAILEYS engine (or route by active engine, not WEBJS fallback).
- In Chatwoot app consumer: do not fail the whole send if
readMessages fails (non-fatal).
- Resolve
@lid → @c.us via /api/{session}/lids/{lid} before read, when applicable.
Related issues
Issue filed: #2115
GitHub Issue — devlikeapro/waha
Title:
[BAILEYS][Chatwoot App] readMessages on @lid chats routes to WEBJS getChat → 500, blocks outbound sendDescription
Environment
GET /api/versionor error payloadversion.version)devlikeapro/waha:latest(digest truncated)WHATSAPP_DEFAULT_ENGINE=BAILEYSWAHA_APPS_ON=chatwootSteps to reproduce
custom_attributes.wa_lid(e.g.{numeric_id}@lid) — normal for WhatsApp privacy / Linked ID.ChatWootInboxMessageCreatedConsumerruns.chatwoot.inbox | message_createdfail after 3 retries.Expected behavior
sendTextMessageshould deliver to WhatsApp even if mark-as-read fails, orreadMessageson BAILEYS session should use Baileys implementation, not WEBJS.Actual behavior
MessageHandler.sendTextMessagecallsawait session.readMessages(chatId)beforesendText:For
@lidchat IDs, internal API call fails:Stack trace shows WEBJS path while session reports BAILEYS:
Version block in error JSON:
Outbound WhatsApp messages never send because the exception aborts before
sendText.Workaround (local patch)
Wrap
readMessagesin try/catch inmessage_created.jsso send proceeds:Suggested fix (upstream)
readChatMessagesfor BAILEYS engine (or route by active engine, not WEBJS fallback).readMessagesfails (non-fatal).@lid→@c.usvia/api/{session}/lids/{lid}before read, when applicable.Related issues
getChat/ WEBJS undefined Store errors on@lidchatsIssue filed: #2115