[GOWS] - 'phone_number should be in e164 format' error causing 'Contact not found' in chatwoot (group messages)
Describe the bug
Something is causing the phone_number of random group messages to be 'invalid' and Chatwoot logs 'Contact not found' error, so some messages are failing to arrive to group chats.
Version
Get the WAHA version by calling GET /api/version
{
"version": "2025.7.10",
"engine": "GOWS",
"tier": "PLUS"
}
Try to update to the latest version before creating an issue!
Steps
To Reproduce Steps to reproduce the behavior:
- join big groups and wait
- get notif error for some messages
Expected behavior
no error, message arrives at chatwoot group conversation
Docker Logs
P.S : detailed message logs sent via email.
JobDetailedError:
ApiError: Generic Error
at catchErrorCodes (/app/node_modules/@figuro/chatwoot-sdk/dist/core/request.js:229:15)
at /app/node_modules/@figuro/chatwoot-sdk/dist/core/request.js:257:17
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
url: 'https://site.com/api/v1/accounts/6/contacts/2469',
status: 422,
statusText: 'Unprocessable Entity',
body: {
message: 'Phone number should be in e164 format',
attributes: [ 'phone_number' ]
},
request: {
method: 'PUT',
url: '/api/v1/accounts/{account_id}/contacts/{id}',
path: { account_id: 6, id: 2469 },
body: { custom_attributes: [Object] },
errors: { '403': 'Access denied', '404': 'Contact not found' }
}
}
JobDetailedError:
ApiError: Generic Error
at catchErrorCodes (/app/node_modules/@figuro/chatwoot-sdk/dist/core/request.js:229:15)
at /app/node_modules/@figuro/chatwoot-sdk/dist/core/request.js:257:17
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
url: 'https://site.com/api/v1/accounts/6/contacts/2469',
status: 422,
statusText: 'Unprocessable Entity',
body: {
message: 'Phone number should be in e164 format',
attributes: [ 'phone_number' ]
},
request: {
method: 'PUT',
url: '/api/v1/accounts/{account_id}/contacts/{id}',
path: { account_id: 6, id: 2469 },
body: { custom_attributes: [Object] },
errors: { '403': 'Access denied', '404': 'Contact not found' }
}
}
JobDetailedError:
ApiError: Generic Error
at catchErrorCodes (/app/node_modules/@figuro/chatwoot-sdk/dist/core/request.js:229:15)
at /app/node_modules/@figuro/chatwoot-sdk/dist/core/request.js:257:17
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
url: 'https://site.com/api/v1/accounts/6/contacts/2469',
status: 422,
statusText: 'Unprocessable Entity',
body: {
message: 'phone_number should be in e164 format',
attributes: [ 'phone_number' ]
},
request: {
method: 'PUT',
url: '/api/v1/accounts/{account_id}/contacts/{id}',
path: { account_id: 6, id: 2469 },
body: { custom_attributes: [Object] },
errors: { '403': 'Access denied', '404': 'Contact not found' }
}
}
Screenshots
Hi, thanks for the report!
We are currently collecting feedback on the ChatWoot integration and will fix bugs and add features in the next iteration once we have a better understanding of what users are using!
You can track all requests by the label: https://github.com/devlikeapro/waha/issues?q=state%3Aopen%20label%3A%22apps%3AChatWoot%22
Hi! ~~Could you attach the full payload for the event? You can mask the real number, but keep the number of digits/country code please~~
UPD found it in email 👍
Edit: Corrected id examples below to exact amount of digits @devlikepro
I think this is related to group ids, in the old format [email protected] it breaks when checking 'if contact is in whatsapp' but in the new format [email protected] its fine. BUT some old groups even in the [email protected] format won't send messages. but msgs are arriving, we just cant send.
Any temporary workaround? EDIT: I found that I can set custom attributes for the contact, great! I set the group chat id and seems like SENDING MESSAGES for "broken" group contacts works now. Also for some group contacts it just won't let me update the chat id custom attribute which is weird, I'll try via API. Edit2: via API also not work.
My group, newly created, works:
older groups that dont work: (didn't have waha_whatsapp_chat_id custom attribute, added it and sending messages works again now)
========== GROUP ERRORS
} {"app":"ChatWoot","component":"ChatWootInboxMessageCreatedConsumer","jobId":"467"}
[11:32:01.566] INFO (6): GET /api/WA_NAMEA/lids/pn/[email protected] {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:01.571] INFO (6): GET 200:OK /api/WA_NAMEA/lids/pn/[email protected] {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:01.571] INFO (6): Updating contact custom attributes for chat.id: [email protected], contact.id: 6832 {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:01.643] INFO (6): Using contact for chat.id: [email protected], contact.id: a522e96b-b971-4d11-a0f8-979df9ee5fb6 {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:01.816] INFO (6): GET /api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B {"app":"ChatWoot","component":"ChatWootInboxMessageCreatedConsumer","jobId":"467"}
[11:32:01.909] INFO (6): Using conversation.id: 282 for contact.id: a522e96b-b971-4d11-a0f8-979df9ee5fb6 {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:01.909] INFO (6): Using conversation for chat.id: [email protected], conversation.id: 282, contact.id: a522e96b-b971-4d11-a0f8-979df9ee5fb6 {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:02.006] INFO (6): Created message as 'outgoing' from WhatsApp: 642191 {"app":"ChatWoot","component":"WAHAMessageAnyConsumer","jobId":"7216"}
[11:32:01.570] INFO (6): request completed {"reqId":118,"req":{"id":118,"method":"GET","url":"/api/WA_NAMEA/lids/pn/[email protected]","query":{},"params":{"path":["api","WA_NAMEA","lids","pn","[email protected]"]}},"res":{"statusCode":200},"responseTime":2}
[11:32:02.083] INFO (6): request errored {"reqId":119,"req":{"id":119,"method":"GET","url":"/api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B","query":{"phone":"+5520988884444-12345678901","session":"WA_B"},"params":{"path":["api","contacts","check-exists"]}},"res":{"statusCode":500},"responseTime":259}
err: {
"type": "TypeError",
"message": "Cannot read properties of undefined (reading 'registered')",
"stack":
TypeError: Cannot read properties of undefined (reading 'registered')
at WhatsappSessionGoWSPlus.checkNumberStatus (/app/dist/core/engines/gows/session.gows.core.js:533:32)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
}
[11:32:02.084] ERROR (6): GET 500 /api/contacts/check-exists {"statusCode":500,"timestamp":"2025-08-05T14:32:02.082Z","exception":{"stack":"TypeError: Cannot read properties of undefined (reading 'registered')\n at WhatsappSessionGoWSPlus.checkNumberStatus (/app/dist/core/engines/gows/session.gows.core.js:533:32)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","message":"Cannot read properties of undefined (reading 'registered')","name":"TypeError"},"request":{"path":"/api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B","method":"GET","query":{"phone":"+5520988884444-12345678901","session":"WA_B"}},"version":{"version":"2025.8.1","engine":"GOWS","tier":"PLUS","browser":null}} {"app":"ChatWoot","component":"ChatWootInboxMessageCreatedConsumer","jobId":"467"}
[11:32:02.087] ERROR (6): Axios Error: Request failed with status code 500
Data: {
"statusCode": 500,
"timestamp": "2025-08-05T14:32:02.082Z",
"exception": {
"stack": "TypeError: Cannot read properties of undefined (reading 'registered')\n at WhatsappSessionGoWSPlus.checkNumberStatus (/app/dist/core/engines/gows/session.gows.core.js:533:32)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
"message": "Cannot read properties of undefined (reading 'registered')",
"name": "TypeError"
},
"request": {
"path": "/api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B",
"method": "GET",
"query": {
"phone": "+5520988884444-12345678901",
"session": "WA_B"
}
},
"version": {
"version": "2025.8.1",
"engine": "GOWS",
"tier": "PLUS",
"browser": null
}
} {"app":"ChatWoot","component":"ChatWootInboxMessageCreatedConsumer","jobId":"467"}
[11:32:02.097] INFO (6): request completed {"reqId":120,"req":{"id":120,"method":"POST","url":"/webhooks/chatwoot/WA_NAMEA/app_JaaXuhvS","query":{},"params":{"path":["webhooks","chatwoot","WA_NAMEA","app_JaaXuhvS"]}},"res":{"statusCode":201},"responseTime":1}
[11:32:02.367] INFO (6): request completed {"reqId":121,"req":{"id":121,"method":"POST","url":"/webhooks/chatwoot/WA_B/app_HWFKj0Ni","query":{},"params":{"path":["webhooks","chatwoot","WA_B","app_HWFKj0Ni"]}},"res":{"statusCode":201},"responseTime":1}
[11:32:04.483] INFO (6): request errored {"reqId":122,"req":{"id":122,"method":"GET","url":"/api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B","query":{"phone":"+5520988884444-12345678901","session":"WA_B"},"params":{"path":["api","contacts","check-exists"]}},"res":{"statusCode":500},"responseTime":257}
err: {
"type": "TypeError",
"message": "Cannot read properties of undefined (reading 'registered')",
"stack":
TypeError: Cannot read properties of undefined (reading 'registered')
at WhatsappSessionGoWSPlus.checkNumberStatus (/app/dist/core/engines/gows/session.gows.core.js:533:32)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
}
[11:32:04.669] INFO (6): request completed {"reqId":123,"req":{"id":123,"method":"POST","url":"/webhooks/chatwoot/WA_B/app_HWFKj0Ni","query":{},"params":{"path":["webhooks","chatwoot","WA_B","app_HWFKj0Ni"]}},"res":{"statusCode":201},"responseTime":1}
[11:32:04.224] INFO (6): GET /api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B {"app":"ChatWoot","component":"ChatWootInboxMessageCreatedConsumer","jobId":"467"}
[11:32:04.484] ERROR (6): GET 500 /api/contacts/check-exists {"statusCode":500,"timestamp":"2025-08-05T14:32:04.482Z","exception":{"stack":"TypeError: Cannot read properties of undefined (reading 'registered')\n at WhatsappSessionGoWSPlus.checkNumberStatus (/app/dist/core/engines/gows/session.gows.core.js:533:32)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","message":"Cannot read properties of undefined (reading 'registered')","name":"TypeError"},"request":{"path":"/api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B","method":"GET","query":{"phone":"+5520988884444-12345678901","session":"WA_B"}},"version":{"version":"2025.8.1","engine":"GOWS","tier":"PLUS","browser":null}} {"app":"ChatWoot","component":"ChatWootInboxMessageCreatedConsumer","jobId":"467"}
[11:32:04.485] ERROR (6): Axios Error: Request failed with status code 500
Data: {
"statusCode": 500,
"timestamp": "2025-08-05T14:32:04.482Z",
"exception": {
"stack": "TypeError: Cannot read properties of undefined (reading 'registered')\n at WhatsappSessionGoWSPlus.checkNumberStatus (/app/dist/core/engines/gows/session.gows.core.js:533:32)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
"message": "Cannot read properties of undefined (reading 'registered')",
"name": "TypeError"
},
"request": {
"path": "/api/contacts/check-exists?phone=%2B5520988884444-12345678901&session=WA_B",
"method": "GET",
"query": {
"phone": "+5520988884444-12345678901",
"session": "WA_B"
}
},
"version": {
"version": "2025.8.1",
"engine": "GOWS",
"tier": "PLUS",
"browser": null
}
Another detail. It seems this error happens because WAHA does not set the chat id custom attribute for some groups for some reason, and it sets a phone number which it should not. (?) Causing the e164 phone number format error
{ "custom_attributes": { "waha_whatsapp_chat_id": "{{ $json.meta.sender.identifier }}" } }
@gkp1 pode me contactar? acho que vou precisar dos seus serviços... manda email para mim [email protected]
I'm having the same
This error occurred with groups already created using another API, deleting the contact with the group name from Chatwoot, and receiving normally again.
The issue happened because the group contact was created in ChatWoot via another API before WAHA connected, and the wrong phone number was saved in phone_number.
-
When WAHA receives a message, it tries to update attributes (via
PUT /api/.../chatwoot).
ChatWoot rejects this because thephone_numberis already invalid in the database, so thewaha_whatsapp_chat_idattribute is never created. -
When you send a message to the chat, WAHA checks custom attributes.
If there’s nowaha_whatsapp_*, it falls back to usingphone_number- which is in the wrong format.
👉 The solution is to remove the phone number on the ChatWoot contact or remove the contact that was previously created via another API, and then start over (as @hereck suggested - thanks!).
The issue happened because the group contact was created in ChatWoot via another API before WAHA connected, and the wrong phone number was saved in
phone_number.
When WAHA receives a message, it tries to update attributes (via
PUT /api/.../chatwoot).
ChatWoot rejects this because thephone_numberis already invalid in the database, so thewaha_whatsapp_chat_idattribute is never created.When you send a message to the chat, WAHA checks custom attributes.
If there’s nowaha_whatsapp_*, it falls back to usingphone_number- which is in the wrong format.
👉 The solution is to remove the phone number on the ChatWoot contact or remove the contact that was previously created via another API, and then start over (as @hereck suggested - thanks!).
Thank you. I did use Evolution API before, so that does explain it. I made a n8n cron to find all group contacts, and unset the phone number if exists. This fixed most group contacts and they work fine. But for some reason chatwoot does not let me do that for SOME contacts and gives a generic error, so I'll need to delete these group contacts with phone number set, and let waha create them again. Chatwoot will probably delete the conversations too but it's no big deal for groups I guess. If you wanna close this, I consider it solved for now!