Skip to content

Message delivered but not received: PN→LID session migration failure causes silent encryption errors #1027

@arthurrferroni

Description

@arthurrferroni

Messages are being marked as "delivered" (double gray check) but the recipient never sees them. This occurs when WhatsApp's Phone Number (PN) to Linked Identity (LID) session migration fails silently.

Environment

  • whatsmeow version: v0.0.0-20251203212742-364369929a75
  • Go version: go 1.24.0

Steps to Reproduce

  • Send a message to a contact whose account has been migrated to WhatsApp's LID system
  • The message shows as "delivered" on sender side (double gray check)
  • Recipient never receives the message on their main device
  • Expected Behavior
  • Message should be delivered and visible on all recipient devices, or sender should receive a retry request to re-encrypt with proper session.

Actual Behavior

  • Message is encrypted successfully for secondary devices (:57, :58) using pkmsg (pre-key message)
  • Main device (:0) encryption fails silently: no signal session established with _1:0
  • No session migration occurs: No sessions or sender keys found to migrate from to _1
  • Delivery receipt is received (because secondary devices got it)
  • No retry receipt is ever received for the main device
  • Recipient never sees the message on their primary device

Log Evidence

[WARN] Failed to encrypt <msgID> for <PN>@s.whatsapp.net: can't encrypt message for device: no signal session established with <LID>_1:0

[DEBUG] No sessions or sender keys found to migrate from <PN> to <LID>_1

[DEBUG] Sending <msgID> to <PN>@s.whatsapp.net with pkmsg (prekey) to <LID>_1:57, <LID>_1:58

Root Cause Analysis

The issue appears to be in the PN→LID session migration logic. When WhatsApp migrates a user from phone number addressing to Linked Identity:

  • Existing Signal sessions are tied to the old PN identifier
  • Migration should copy/recreate sessions for the new LID identifier
  • Migration fails: "No sessions or sender keys found to migrate"
  • Main device (:0) has no valid session, but secondary devices can receive via pre-key messages
  • Delivery receipts from secondary devices trick the sender into thinking message was delivered

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions