[BUG] Brazilian 9th digit lost in LID/PN mapping - messages remain PENDING
Maintainers usually reply within 6 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- docker, postgresql, typescript
Research direction
No source file or test is named. Start by tracing the Baileys LID/PN handling and the OnWhatsappCache/saveOnWhatsappCache path, then reproduce the mapping with the stated Brazilian number and LID. Done would require preserving the ninth digit, routing replies to the correct JID, and verifying delivery acknowledgements rather than only HTTP 201.
Written by the indexing model from the issue text.
Description
📋 Bug Description
[BUG] Brazilian number loses 9th digit in LID/PN mapping and outbound messages stay PENDING
Environment
- Evolution API: v2.3.7
- Docker image:
evoapicloud/evolution-api:latest - Provider: Baileys
- Deployment: Docker / Ubuntu VPS
- Integration: n8n webhook
- PostgreSQL enabled
- Redis container present
Problem
Incoming WhatsApp messages are received, but Evolution/Baileys is mapping a Brazilian mobile number to an incorrect PN/JID.
Real phone number:
+55 47 98921-1984
Expected PN/JID:
Evolution resolves it as:
The ninth digit 9 after Brazilian area code 47 is lost.
Evidence
Evolution log:
[OnWhatsappCache] [saveOnWhatsappCache] Register exists for [[email protected],[email protected]]? => [email protected]
Incoming events also showed LID addressing and remoteJidAlt.
A local session/volume inspection found this mapping:
185031603552434@lid -> 554789211984
The expected mapping would correspond to:
Direct outbound test
We bypassed n8n completely and sent directly through Evolution to:
185031603552434@lid
Result:
- HTTP: 201
- Message ID:
3EB0D17079F19FC30DC37A - Final status: PENDING
- SERVER_ACK: not received
- DELIVERY_ACK: not received
- Message received by destination phone: NO
Therefore HTTP 201 only queued/accepted the message; it was never delivered.
Important observations
n8n is not the origin of the incorrect phone mapping.
The incorrect PN already exists in the Evolution/Baileys LID/PN mapping.
Updating/restarting Evolution did not correct the existing mapping.
Redis DBSIZE returned 0.
The WhatsApp connection itself remains active and incoming messages are received.
Expected behavior
For the Brazilian mobile number:
+55 47 98921-1984
Evolution/Baileys should resolve the phone JID as:
When an inbound event uses LID addressing, Evolution should maintain a correct and stable relationship between the LID and this PN.
A reply to the inbound contact must be delivered to the same WhatsApp user.
Actual behavior
Evolution/Baileys associates the contact with:
instead of:
and direct outbound messages remain PENDING without SERVER_ACK or DELIVERY_ACK.
Request for maintainers
Could you please confirm:
- Is this a known Brazilian 9th-digit issue in the current LID/PN mapping?
- How can the incorrect cached/session mapping be safely rebuilt without deleting the entire WhatsApp instance?
- Is there an upstream patch/commit that fixes this behavior on v2.3.7?
- Is the recent LID → phone JID work intended to fix this case?
- Is there a supported way to force Baileys/Evolution to refresh the LID ↔ PN association from WhatsApp?
- Why does direct
sendTextreturn HTTP 201 but remain PENDING with no SERVER_ACK?
We can provide sanitized logs and additional diagnostic output if needed.
Please note that this is affecting a production customer-service automation because incoming messages are received but replies cannot reliably return to the sender.
🔄 Steps to Reproduce
- Connect a Brazilian WhatsApp number to Evolution API v2.3.7 using Baileys.
- From +55 47 98921-1984, send a WhatsApp message to the connected Evolution instance.
- Evolution receives the incoming message using LID addressing.
- Inspect the LID/PN mapping and remoteJid/remoteJidAlt.
- Evolution maps the real number 5547989211984 to 554789211984, incorrectly removing the Brazilian ninth digit.
- Reply directly through Evolution API to the received contact/LID.
- The API returns HTTP 201, but the message remains PENDING with no SERVER_ACK or DELIVERY_ACK and is not delivered to the phone.
✅ Expected Behavior
For Brazilian WhatsApp numbers, Evolution API must preserve the correct phone number associated with the LID.
For this case, the real sender is:
+55 47 98921-1984
Expected PN/JID:
[email protected]
The LID must be mapped to 5547989211984, not to 554789211984.
When replying to the received message, Evolution API should route the response to the same real sender and obtain SERVER_ACK / DELIVERY_ACK instead of remaining PENDING.
❌ Actual Behavior
Evolution API receives the incoming WhatsApp message, but the LID is being associated with the wrong Brazilian phone number.
Real sender:
+55 47 98921-1984
Correct JID:
[email protected]
Incorrect mapping currently stored:
185031603552434@lid -> 554789211984
When Evolution replies using this mapping, sendText returns HTTP 201, but the message remains PENDING. No SERVER_ACK or DELIVERY_ACK is received and the message does not reach the real sender.
The incorrect PN mapping persists even after updating Evolution API v2.3.7 and restarting the instance.
🌍 Environment
- OS: [e.g. Ubuntu 20.04, Windows 10, macOS 12.0]
- Node.js version: [e.g. 18.17.0]
- Evolution API version: [e.g. 2.3.7]
- Database: [e.g. PostgreSQL 14, MySQL 8.0]
- Connection type: [e.g. Baileys, WhatsApp Business API]
📋 Logs
Evolution API: v2.3.7
Image: evoapicloud/evolution-api:latest
Real WhatsApp sender:
+55 47 98921-1984
Expected JID:
[email protected]
LID:
185031603552434@lid
Incorrect mapping found locally:
185031603552434@lid -> 554789211984
Direct send test:
HTTP: 201
Final status: PENDING
SERVER_ACK: not received
DELIVERY_ACK: not received
Message delivered to phone: NO
📝 Additional Context
This issue is affecting a production customer-service automation.
Incoming WhatsApp messages reach Evolution API and n8n correctly, but replies fail because the LID is mapped to an incorrect Brazilian PN.
We have already updated/restarted Evolution API and verified the mapping directly. We do not want to manually add/remove/reorder digits as a workaround.
Please identify the correct way to rebuild or refresh the LID -> PN mapping and confirm whether this is a known issue in v2.3.7 / Baileys.
If a fix, commit, newer image, cache reset procedure, or database repair exists, please provide the exact procedure.
- Dominant language
- TypeScript
- Stars
- 9.7k
- Forks
- 7.3k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from evolution-foundation/evolution-api
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
evolution-foundation/evolution-api#2723 ·
Maintainers usually reply within 6 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
evolution-foundation/evolution-api#2704 ·
Maintainers usually reply within 6 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
evolution-foundation/evolution-api#2702 ·
Maintainers usually reply within 6 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
evolution-foundation/evolution-api#2700 · 1 comment ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
evolution-foundation/evolution-api#2675 ·
Maintainers usually reply within 6 days
All issues in evolution-foundation/evolution-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
automated issue report
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 92/100
github/copilot-sdk#2804 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
drizzle-team/drizzle-orm#6418 ·
Maintainers usually reply within 4 days
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
diegosouzapw/OmniRoute#15307 · 1 comment ·
Maintainers usually reply within 2 days