-
-
Notifications
You must be signed in to change notification settings - Fork 69.2k
Telegram: 'Failed to download media' when attaching files in group topics #32326
Copy link
Copy link
Open
Description
Description
Attaching a .md file (document) in a Telegram group topic intermittently triggers:
⚠️ Failed to download media. Please try again.
The bot replies with this error instead of processing the file.
Environment
- OpenClaw version:
2026.3.1 - Channel: Telegram
- Chat type: Group with topics (forum mode)
- File type:
.md(small text file, well under 20MB bot API limit)
Expected Behavior
The file should be downloaded and processed. If it fails transiently, the retry logic (currently 3 attempts) should handle it.
Actual Behavior
The resolveMedia flow calls ctx.getFile() → downloads from https://api.telegram.org/file/bot<token>/<path> but fails, triggering the generic error message.
Analysis
Looking at the source (reply-XaR8IPbY.js):
hasInboundMediacorrectly detectsmsg.documentresolveInboundMediaFileIdextractsdocument.file_idretryAsyncwith 3 attempts, 1-4s delay with jitter- On failure, logs
"media fetch failed"at warn level but the specific error is not included in the user-facing message
Possible Causes
- Race condition in group topics: Telegram may not make the file available via Bot API immediately in forum/topic messages
- Insufficient retry window: 3 retries × 1-4s may not be enough for topic messages
- Telegram API flakiness:
getFilemay return withoutfile_pathintermittently
Suggestions
- Include the actual error in the user-facing message (or at least in logs) for debuggability
- Consider increasing retry count or delay for group/topic contexts
- Add a longer initial delay before first
getFileattempt for topic messages - Persist the error details in gateway logs for post-mortem analysis
Reproduction
Intermittent. Send a .md file as a document in a Telegram group with topics enabled. More likely to occur than in DMs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.