Fresh-link first outbound sometimes not delivered until inbound (old counter); guidance on key/session readiness?
Author: alexph-devCreated Mar 4, 2026Updated Mar 4, 2026
Summary
In production linked-device usage, we observe two related behaviors:
- LID->PN mappings exist in
whatsmeow_lid_map, but app-layer clients often still expose opaque@lididentities unless they manually join/map. - After fresh link, first outbound message to some contacts may appear sent but is not received until recipient sends inbound first (then delivery works).
I know some LID threads already exist; this report adds a concrete field observation from a fresh deployment.
Environment
- WhatsApp linked-device session (QR)
- Client stack using whatsmeow (via wacli)
- Linux host
Repro (delivery gap)
- Freshly link device.
- Send outbound text to contact A.
- Sender sees successful send/outbox entry.
- Contact A does not receive.
- Contact A sends any inbound message.
- Subsequent outbound messages to A deliver successfully.
Relevant log seen
SessionCipher.go:310 Unable to get or create message keys: received message with old counter (index: 2, count: 1)
Observed
- A key/session readiness mismatch seems possible immediately after linking for some peers.
- Behavior looks like key ratchet/session repair occurs after inbound traffic.
Expected
- First outbound after successful link should reliably deliver.
- If not possible, API should expose clearer pre-send key/session status or a recommended handshake/retry flow.
LID mapping note
whatsmeow_lid_map is extremely useful and does contain real mappings in our case. A short best-practice note in docs for app developers (when/how to apply map to chat identity display) would help many downstream tools.
Ask
- Any recommended canonical flow for ensuring key/session readiness right after fresh link?
- Is the
old countercondition expected transient behavior or a bug to track? - Recommended retry/backoff/session-reset strategy?
Source: tulir/whatsmeow