[BUG] Brazilian 9th digit lost in LID/PN mapping - messages remain PENDING
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 30/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- docker, postgresql, typescript
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
📋 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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 9.7k
- Forks
- 7.3k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus evolution-foundation/evolution-api
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
evolution-foundation/evolution-api#2723 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
evolution-foundation/evolution-api#2704 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
evolution-foundation/evolution-api#2702 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
evolution-foundation/evolution-api#2700 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
evolution-foundation/evolution-api#2675 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in evolution-foundation/evolution-api
Ähnliche Issues
-
bug via-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
pingdotgg/t3code#14452 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
solana-foundation/program-examples#747 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 9 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
remotion-dev/remotion#11847 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
openwatersio/slackwater#355 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
melgarafael/DeskcommCRM#1998 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag