[WEBJS] - Cannot read properties of undefined (reading 'markedUnread') when calling api/sendText
Describe the bug
Calling POST /api/sendText fails with a 500 Internal Server Error when trying to send a message.
The error is a TypeError:
Cannot read properties of undefined (reading 'markedUnread')
The stack trace shows it happens inside window.WWebJS.sendSeen when Client.sendMessage is called by WAHA:
TypeError: Cannot read properties of undefined (reading 'markedUnread')
at window.WWebJS.sendSeen (evaluate at WPage.evaluate (...), <anonymous>:13:40)
at #evaluate (.../ExecutionContext.js:391:56)
at async ExecutionContext.evaluate (.../ExecutionContext.js:277:16)
at async IsolatedWorld.evaluate (.../IsolatedWorld.js:100:16)
at async CdpFrame.evaluate (.../Frame.js:362:20)
at async CdpPage.evaluate (.../Page.js:818:20)
at async WPage.evaluate (.../WPage.js:13:20)
at async WebjsClientCore.sendMessage (.../whatsapp-web.js/src/Client.js:1100:25)
at async descriptor.value (.../core/abc/activity.js:9:20)
...
So it looks like the code tries to access a markedUnread property on an undefined message/chat object while sending or marking the chat as seen.
Version
Result of GET /api/version (from the error payload):
{
"version": "2026.1.2",
"engine": "WEBJS",
"tier": "CORE",
"browser": "/usr/bin/chromium",
"platform": "linux/x64"
}
Steps
To Reproduce
- Start WAHA with engine
WEBJSand a runningdefaultsession. - Send a POST request to
POST /api/sendTextwith a validchatIdandtext. - The server responds with HTTP 500.
- Docker logs show the
TypeError: Cannot read properties of undefined (reading 'markedUnread')originating fromwindow.WWebJS.sendSeeninsidewhatsapp-web.jsClient.sendMessage.
Expected behavior
The text message should be sent successfully to the specified chatId, and the endpoint should return a success response (e.g. 200 OK with message info) without throwing any internal error related to markedUnread or sendSeen.
Requests - Responses
Request
POST /api/sendText
Content-Type: application/json
Body (personal data redacted):
{
"chatId": "[email protected]",
"text": "Hi there!",
"session": "default"
}
Error Response (500)
{
"statusCode": 500,
"timestamp": "2026-01-14T14:11:21.980Z",
"exception": {
"message": "Cannot read properties of undefined (reading 'markedUnread')\nI (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:4171)\nObject.<anonymous> (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:1751)",
"name": "TypeError",
"stack": "TypeError: Cannot read properties of undefined (reading 'markedUnread')\nI (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:4171)\nObject.<anonymous> (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:1751)\n at window.WWebJS.sendSeen (evaluate at WPage.evaluate (/app/dist/core/engines/webjs/WPage.js:13:36), <anonymous>:13:40)\n at #evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:391:56)\n at async ExecutionContext.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:277:16)\n at async IsolatedWorld.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:16)\n at async CdpFrame.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:362:20)\n at async CdpPage.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:818:20)\n at async WPage.evaluate (/app/dist/core/engines/webjs/WPage.js:13:20)\n at async WebjsClientCore.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:1100:25)\n at async descriptor.value (/app/dist/core/abc/activity.js:9:20)\n ..."
},
"request": {
"path": "/api/sendText",
"method": "POST",
"body": {
"chatId": "[email protected]",
"text": "Hi there!",
"session": "default"
},
"query": {}
},
"version": {
"version": "2026.1.2",
"engine": "WEBJS",
"tier": "CORE",
"browser": "/usr/bin/chromium",
"platform": "linux/x64"
}
}
Docker Logs
waha-1 | [14:11:21.981] INFO (47): request errored {"reqId":138,"req":{"id":138,"method":"POST","url":"/api/sendText","query":{},"params":{"path":["api","sendText"]}},"res":{"statusCode":500},"responseTime":46}
waha-1 | err: {
waha-1 | "type": "Error",
waha-1 | "message": "Cannot read properties of undefined (reading 'markedUnread')\nI (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:4171)\nObject.<anonymous> (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:1751)",
waha-1 | "stack":
waha-1 | TypeError: Cannot read properties of undefined (reading 'markedUnread')
waha-1 | I (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:4171)
waha-1 | Object.<anonymous> (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1540:1751)
waha-1 | at window.WWebJS.sendSeen (evaluate at WPage.evaluate (/app/dist/core/engines/webjs/WPage.js:13:36), <anonymous>:13:40)
waha-1 | at #evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:391:56)
waha-1 | at async ExecutionContext.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:277:16)
waha-1 | at async IsolatedWorld.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:16)
waha-1 | at async CdpFrame.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:362:20)
waha-1 | at async CdpPage.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:818:20)
waha-1 | at async WPage.evaluate (/app/dist/core/engines/webjs/WPage.js:13:20)
waha-1 | at async WebjsClientCore.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:1100:25)
waha-1 | at async descriptor.value (/app/dist/core/abc/activity.js:9:20)
waha-1 | at v (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1539:1311)
waha-1 | at <anonymous> (https://static.whatsapp.net/rsrc.php/v4/yv/r/0p5QPbRp7Rp.js:106:276)
waha-1 | at <anonymous> (https://static.whatsapp.net/rsrc.php/v4/yv/r/0p5QPbRp7Rp.js:106:407)
waha-1 | at i (https://static.whatsapp.net/rsrc.php/v4/yv/r/0p5QPbRp7Rp.js:106:348)
waha-1 | at l (https://static.whatsapp.net/rsrc.php/v4/yv/r/0p5QPbRp7Rp.js:106:124)
waha-1 | at <anonymous> (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1539:1750)
waha-1 | at I (https://static.whatsapp.net/rsrc.php/v4iiPd4/ya/l/en_US-j/JAfHf_4WnGs.js:1539:4170)
waha-1 | "name": "TypeError"
waha-1 | }
Additional context
- Engine:
WEBJS - Tier:
CORE - Running on Linux (
linux/x64) with Chromium binary at/usr/bin/chromium. - It looks like
whatsapp-web.js(or the WAHA wrapper around it) is trying to callsendSeenon a chat/message that is not fully initialized or isundefined. - The bug might be related to chats that are archived/unavailable, or a recent change in WhatsApp Web where
markedUnreadno longer exists / is not present on some chat objects.
same error +1
same error +1
mismo error +1
English
same error +1
same error +1
same error +1
same error +1
same error +1
Possible solution go to NOWEB. Sending message working
same error +1
same error +1 only happens in WEBJS version, in GOWS works fine.
same error +1
same error +1 only happens in WEBJS version, in GOWS works fine.
How do you use GOWS?
+1 Same issue. Switching to NOWEB also did not fix it.
Same here .. Since some time. But strangely my other 2 sessions are not impacted.
Fixed for me after using the GOWS engine.
To run using GOWS: https://waha.devlike.pro/docs/engines/gows/
You wont have a Web Dashboard but you can use the Postman Plugin for WAHA, to configure sessions and get going
same here, service broken... any workarround or must downgrade ?
same here!
Another one, to keep service going i am receiving with waha and sending with z-api....but no long term solution