evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

Bug Report: Outgoing messages stuck in PENDING, never delivered (Evolution API 2.4.0, Baileys)

Open chimaras opened this issue 5 months ago • 34 comments

Bug Report: Outgoing messages stuck in PENDING, never delivered (Evolution API 2.4.0, Baileys)**

Evolution API version

2.4.0 (homolog tag), license activated successfully (community tier)

Database

PostgreSQL 15

Connection type

Baileys (WhatsApp Web)

What I did

Sent text messages via /message/sendText/{instance}, both from my own backend and directly from the Evolution Manager UI, to a real, active WhatsApp number that I personally control and actively monitor.

What happened

  • API call returns 200 OK with a valid messageId, status PENDING
  • Message never progresses past PENDING in Message.status
  • Message is never received on the destination phone (confirmed visually on the device, multiple times, over several hours)
  • This happens regardless of: client (own backend vs Manager UI directly), message content, or time of day

Database evidence

sqlSELECT status, COUNT(*) FROM "Message" WHERE "key"->>'fromMe'='true' GROUP BY status;Result: 74 PENDING, 1 READ, 1 SERVER_ACK — out of 76 total outbound messages since instance creation (June 18). This has been consistent since day one, not something that started recently.

Instance state

connectionState reports state: "open" consistently and stably — instance shows as connected.

Logs (evolution-api container)

Repeated, on every message send attempt:Closing session: SessionEntry { ... }On first pairing (once): a stream:error with code: "515", followed by an automatic full session restart (ChannelStartupService re-init).

Steps already taken (none resolved it)

  1. Full logout + re-scan QR from scratch — same behavior after reconnect
  2. Updated from 2.3.7 (latest) to 2.4.0 (homolog) + activated community license — same behavior
  3. Confirmed correct webhook config (was a separate, now-fixed issue: webhookByEvents: true was causing 404s on event-specific routes — fixed, unrelated to this delivery issue)
  4. Sent directly via Manager UI (bypassing my own backend entirely) — same PENDING-forever result
  5. Verified the receiving number is correct and active (confirmed visually on the device)

Possible related context

The conversation in question appears to use a WhatsApp @lid JID (remoteJid ending in @lid with remoteJidAlt as the real phone number) for inbound messages — possibly related to WhatsApp's newer privacy/multi-device addressing mode. I'm aware of the documented @lid onWhatsApp exists:false issue, but my outbound sends to the plain @s.whatsapp.net JID (the phone number) are equally stuck in PENDING, so I'm not certain this is the same root cause.

Question

Is PENDING-forever with no SERVER_ACK/DELIVERY_ACK a known symptom of something specific (rate limiting, account flagging, a particular WhatsApp Web version mismatch)? Is there a way to get more diagnostic detail on why a specific message never leaves PENDING (e.g. a stream-level error per message, not just connection-level)?

Happy to provide instance_id, full logs, or any other diagnostic info needed.

chimaras avatar Jun 23 '26 05:06 chimaras

Seems problem was solved (currently working for my instances previously affected). I found more info here: https://github.com/WhiskeySockets/Baileys/issues/2667

albedeployer avatar Jul 02 '26 10:07 albedeployer

Seems my number is getting restricted. Any idea why? I never user automated message. Only use chatwoot.

crawdz-cpu avatar Jul 02 '26 11:07 crawdz-cpu

Estou com o mesmo problema relatado acima, começou ontem, já exclui a instancia e criei novamente e nada estou usando a versão 2.3.7

paulofausto31 avatar Jul 02 '26 14:07 paulofausto31

Still having same issue but my phone number got flag after unflagging the phone number receive all information but unable to send message

t1t0l avatar Jul 03 '26 15:07 t1t0l

I’m experiencing the same issue.

Everything was working correctly until the last 24 hours. The webhook still receives incoming messages and triggers the workflow normally, but when I send a message through Evolution API, the API response shows that the message was sent, while nothing appears on WhatsApp.

I suspect this may be related to the latest WhatsApp update, especially because WhatsApp seems to have started adding usernames to contacts. Maybe this change affected how Baileys/Evolution handles contact identifiers, JIDs, or message delivery.

This was working normally before, so it looks like a recent compatibility issue rather than a configuration problem.

MedAmineCk avatar Jul 03 '26 17:07 MedAmineCk

Estava com esse problema até ontem quando resolvi outro número de telefone na instância da evolution-api e tudo voltou a funcionar, depois descobri que o número que estava utilizando como teste havia sido cancelado por falta de recargas

paulofausto31 avatar Jul 03 '26 18:07 paulofausto31

Same setup (2.4.0 homolog, community license, PG15). Two additional data points: (1) sending to the same contact via @lid IS delivered while the PN JID is not — consistent with tctokens being stored under LID per the root-cause analysis in WhiskeySockets/Baileys#2441 (reach-out time-lock from missing tctoken/cstoken); (2) full session re-pair does not resolve it. Fix appears to be the Baileys v7 RC tctoken implementation (PRs #2257/#2339/#2438) — is a Baileys bump planned for Evolution?

agungpmbd avatar Jul 07 '26 22:07 agungpmbd

Same problem.

RicardoSysDevOps avatar Jul 08 '26 20:07 RicardoSysDevOps

English:

Update: Managed to work around this on Evolution API 2.3.7 (Easypanel deployment). Same exact symptom: success: true / status: PENDING in the API response, but container logs showed the real failure right after — repeated Closing session (libsignal) followed by messageStubParameters: ["463"] and status: 0 on every single outbound send, regardless of recipient. Incoming messages worked fine (DELIVERY_ACK), only outbound was broken.

Root cause: Evolution 2.3.7 pins [email protected], which is missing the tctoken/cstoken handling that WhatsApp now requires to avoid the NackCallerReachoutTimelocked (463) rate-limit. That fix landed upstream in Baileys around v7.0.0-rc13 (src/Utils/tc-token-utils.ts).

Fix: since a plain npm install [email protected] inside the running container doesn't survive a redeploy (Easypanel rebuilds the container from the image each time), I overrode the service's start Command to reinstall the patched version on every boot, before the normal entrypoint:

sh -c "npm install [email protected] && npm run db:deploy && npm run db:generate && npm run start:prod" After reconnecting the instance, outbound messages stopped hitting 463 and started delivering normally (double-check on the recipient's WhatsApp). Not an official fix, but works as a stopgap until Evolution bumps its own Baileys dependency.

Español:

Actualización: logré resolverlo (como workaround) en Evolution API 2.3.7 sobre Easypanel. Mismo síntoma exacto: la API respondía success: true / status: PENDING, pero en los logs del contenedor se veía el fallo real justo después — Closing session (libsignal) repetido, seguido de messageStubParameters: ["463"] y status: 0 en cada envío saliente, sin importar el destinatario. Los mensajes entrantes andaban perfecto (DELIVERY_ACK), solo el envío estaba roto.

Causa raíz: la 2.3.7 de Evolution fija [email protected], que no tiene el manejo de tctoken/cstoken que WhatsApp ahora exige para evitar el rate-limit NackCallerReachoutTimelocked (463). Ese fix se integró en Baileys upstream cerca de v7.0.0-rc13 (src/Utils/tc-token-utils.ts).

Solución: como un simple npm install [email protected] dentro del contenedor corriendo no sobrevive a un redeploy (Easypanel reconstruye el contenedor desde la imagen cada vez), tuve que sobreescribir el Command de arranque del servicio para que reinstale la versión parchada en cada inicio, antes del entrypoint normal:

sh -c "npm install [email protected] && npm run db:deploy && npm run db:generate && npm run start:prod" Después de reconectar la instancia, los mensajes salientes dejaron de tirar el 463 y empezaron a entregarse normal (doble tilde en el WhatsApp del destinatario). No es un fix oficial, pero funciona como parche mientras Evolution actualiza su propia dependencia de Baileys.

hahahasasj123-pixel avatar Jul 09 '26 17:07 hahahasasj123-pixel

[email protected] não resolveu!

pablodc avatar Jul 13 '26 19:07 pablodc

Update: confirming the [email protected] workaround also works on the homolog image via docker-compose — with two side-effects worth documenting.

English:

Setup: evoapicloud/evolution-api:homolog (v2.4.0, community license), PostgreSQL 15, Redis, Chatwoot integration, plain docker-compose on Ubuntu 24.04 VPS. Same symptom as OP: outbound personal messages stuck in PENDING forever (MessageUpdate.status = ERROR, repeated Closing session in logs), groups and inbound fine. Confirmed the bundled Baileys was still 7.0.0-rc.9 (no tc-token-utils in node_modules/baileys/lib/Utils).

Since docker-compose users can't override the start command the Easypanel way — the image defines an ENTRYPOINT (/bin/bash -c ". ./Docker/scripts/deploy_database.sh && npm run start:prod"), so a command: override is silently ignored — the working approach is overriding the entrypoint itself:

entrypoint: ["/bin/bash", "-c", "npm install [email protected] && . ./Docker/scripts/deploy_database.sh && npm run start:prod"]

Then docker compose up -d --force-recreate. Verify with:

docker exec evolution-api sh -c "grep '\"version\"' node_modules/baileys/package.json; ls node_modules/baileys/lib/Utils | grep -i tc-token"

Result: outbound personal messages deliver again (double ticks on recipient device). Note: if the account already accumulated a reach-out time-lock (463) before patching, delivery only resumes after the lock expires server-side — in our case several days after we stopped all PN send attempts. The patch prevents new accumulation; it does not lift an active lock.

Two side-effects observed after the patch, for anyone else trying this:

  1. IntegrationSession FK violations: after the Baileys swap (and some session surgery), inbound processing intermittently threw Invalid a.integrationSession.update() invocation … Foreign key constraint violated, which even blocked POST /instance/create. Clearing the orphaned rows (DELETE FROM "IntegrationSession"; — safe if you don't use the built-in chatbot integrations) + restart resolved it.

  2. Inbound personal messages now arrive in ~0–60s batches instead of instantly: messages.upsert timestamps cluster at roughly the same second each minute (looks like delivery on a keepalive/flush cycle rather than server push). Outbound is real-time; Evolution→Chatwoot forwarding is <1s. Acceptable as a stopgap, but worth knowing before deploying to latency-sensitive flows.

Not an official fix — reinstalls on every boot and requires registry.npmjs.org access at start — but it restores operations until Evolution bumps its Baileys dependency. @evolution-foundation any ETA on an official release with Baileys ≥ rc13?

Español:

Confirmo que el workaround de [email protected] también funciona en la imagen homolog con docker-compose. Ojo: la imagen define un ENTRYPOINT propio, así que command: se ignora — hay que sobreescribir el entrypoint (ver arriba). Tras el parche, los mensajes salientes 1:1 vuelven a entregarse; si la cuenta ya acumuló el time-lock 463, la entrega recién se normaliza cuando el bloqueo expira del lado del servidor (en nuestro caso, varios días sin intentar envíos PN). Dos efectos secundarios: (1) violaciones de FK en IntegrationSession que incluso bloqueaban la creación de instancias — se resuelve limpiando las filas huérfanas y reiniciando; (2) los mensajes entrantes 1:1 ahora llegan en lotes de ~0–60s (ciclo de keepalive) en vez de instantáneo. No es un fix oficial, pero restaura la operación hasta que Evolution actualice su dependencia de Baileys.

agungpmbd avatar Jul 21 '26 06:07 agungpmbd

got same issue, no error message, just successful run but WhatsApp not able to received messages

semilieann avatar Jul 27 '26 13:07 semilieann

RESOLVIDO: Estava com o mesmo problema no Evolution GO. Descobri, que era quando eu fazia a conexão pelo qr code, dava esse erro. Agora quando faço utilizando somente os códigos gerado pelo evolution go, funciona!

fdk-developer avatar Jul 31 '26 20:07 fdk-developer

Estou com o mesmo problema aqui, uma instancia funciona e a outra gera esse peding, ja tentei realizar a reconexão, reiniciar o container e nada.

b44sistemas avatar Aug 06 '26 17:08 b44sistemas