Skip to content

msgconv/wa-media: reupload media when the direct media URI can't be generated - #1085

Open
indent[bot] wants to merge 2 commits into
mainfrom
indent/whatsapp-direct-media-uri-fallback
Open

indent[bot] wants to merge 2 commits into
mainfrom
indent/whatsapp-direct-media-uri-fallback

Conversation

@indent

@indent indent Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Logs

Event handling panicked 5,898 in 24 h (prev 4,598) and Panic in backfill queue 1,175 (prev 65). All of them are failed to generate content URI: content URI too long (256..270 > 255) from convertMediaMessage. Most are channel media, which #1083 covers. Sampling 15-minute windows every 3 h on all clusters also found at least 4 accounts panicking outside channels: @lid DMs during backfill (264-270 > 255) and a group image from an @lid sender (256 > 255). They recur in every window.

Cause

convertMediaMessage panics when GenerateContentURI fails. Media IDs store LID JIDs as raw strings, and encrypted direct media makes the URI longer, so long usernames go past 255. The live message is dropped, and a backfill batch aborts and retries without making progress.

Change

On a content URI error, log a warning and reupload the media the way the non-direct-media path does, instead of panicking. The sticker MIME rewrite now runs only when direct media is actually used. Sticker pack import gets the same fallback. Doesn't conflict with #1083 (different file).

Before / after

Tested on a live account.

Case Base Head
@lid DM backfill with media, content URI over 255 Event handling panicked (content URI too long); 0 of 30 messages Reupload warning; 30 of 30 messages, 22 media reuploaded
Same DM, content URI under 255 22 media served as direct media Same, identical bytes

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

@indent

indent Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Issues

No issues found.

CI Checks

All required CI checks passed on df871ec.

Review agents

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

Passed (1)
  • Indent Review Agent · No bugs found in the media/sticker fallbacks.
Full results

Indent Review Agent

  • Summary: No bugs found in the media/sticker fallbacks.
  • Last ran on commit: df871eca
  • Latest result
    {
      "summary": "No bugs found in the media/sticker fallbacks.",
      "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