Skip to content

waid: store newsletter JIDs as integers in media IDs - #1083

Open
indent[bot] wants to merge 1 commit into
mainfrom
indent/whatsapp-newsletter-media-id-length
Open

indent[bot] wants to merge 1 commit into
mainfrom
indent/whatsapp-newsletter-media-id-length

Conversation

@indent

@indent indent Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Logs

Event handling panicked 4,598 in 24 h (prev 0) and Panic in backfill queue 65 (prev 0), on all clusters, starting when encrypted direct media was enabled. Loki sample (four 15-minute windows on 4 clusters): 95 panics across at least 41 accounts and 23 channels, every one on a @newsletter chat (image/audio/video/sticker), with failed to generate content URI: content URI too long (256..273 > 255). History sync for affected channels panics the same way and retries hourly without progress.

Cause

compactJID only shortens s.whatsapp.net and g.us, so MakeMediaID stores the newsletter JID as a raw string twice (chat and sender), giving a 110-124 byte media ID. Encrypted direct media adds an 8-byte random part to the URI, which pushes channel media past 255 characters, and convertMediaMessage panics on the error.

Change

Newsletter JIDs are now stored as 8-byte integers (new compact type 4), the same way phone-number users are. A channel media ID drops by 42 bytes (110-116 to 68-74 in a live run), about 56 fewer URI characters. Existing raw-string media IDs still parse.

Before / after

Tested on a live account.

Case Base Head
Channel history with photos/videos, encrypted room, long username Event handling panicked: content URI too long (257 > 255); 0 of 11 posts 11 of 11 posts; 8 media served as encrypted direct media
Channel media URIs created before the fix Download, correct bytes Still download, identical bytes

View in Indent
Tag @indent to continue the conversation here.

@indent

indent Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Issues

No issues found.

CI Checks

All required CI checks passed on cd077d2.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found in newsletter JID compaction.
Full results

Indent Review Agent

  • Summary: No issues found in newsletter JID compaction.
  • Last ran on commit: cd077d2f
  • Latest result
    {
      "summary": "No issues found in newsletter JID compaction.",
      "findings": []
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant