#18533: fix(telegram): handle 'file is too big' error for large files
channel: telegram
agents
size: XS
trusted-contributor
Cluster:
Slack Thread Management Improvements
When a user sends a file >20MB via Telegram, the bot API's getFile call fails with "400: Bad Request: file is too big". The handler was only catching errors with "exceeds" and "MB limit" patterns, but Telegram now also returns "file is too big".
This fix adds handling for the "file is too big" error pattern so the handler gracefully skips the attachment and still processes any text content in the message.
Fixes #18518
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR extends Telegram's file size error handling to catch the "file is too big" error message (in addition to the existing "exceeds MB limit" pattern) when users upload files >20MB.
**Key changes:**
- `src/telegram/bot-handlers.ts`: Added pattern matching for "file is too big" error alongside existing size limit checks
- Unrelated changes included: `src/agents/transcript-policy.ts` (OpenAI-compatible API tool call ID sanitization) and workspace files (`BOOTSTRAP.md`, `SOUL.md`, etc.) that shouldn't be in this PR per previous review feedback
<h3>Confidence Score: 4/5</h3>
- The core Telegram fix is safe and correct, but the PR includes unrelated commits that should be removed
- The Telegram file size error handling fix is straightforward and correct - it simply adds another error pattern to catch. However, the PR includes unrelated changes (transcript-policy.ts and workspace files) that were flagged in previous review comments and should be separated into different PRs. The core fix itself has no issues.
- The workspace files (`.openclaw/workspace-state.json`, `BOOTSTRAP.md`, `HEARTBEAT.md`, `SOUL.md`, `TOOLS.md`) and `src/agents/transcript-policy.ts` should be removed from this PR as they're unrelated to the Telegram fix
<sub>Last reviewed commit: c980869</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#17081: fix(telegram): suppress file-size error replies in groups when bot ...
by p697 · 2026-02-15
83.0%
#11347: fix: scope Telegram update offset to bot token
by anooprdawar · 2026-02-07
79.7%
#16548: fix(telegram): enhance chat_id validation and diagnostics
by tanujbhaud · 2026-02-14
79.4%
#11340: Telegram: skip empty message text instead of throwing (#11238)
by lailoo · 2026-02-07
77.9%
#7218: fix(telegram): skip empty text messages in threaded mode
by ArsalanShakil · 2026-02-02
77.7%
#21898: fix(telegram): auto-detect captionable messages for editMessageCaption
by ptrkstr · 2026-02-20
77.4%
#12870: fix: recover from telegram fetch errors (issue #12835)
by ambicuity · 2026-02-09
77.4%
#3186: fix(telegram): sanitize update offset + lock polling
by daxiong888 · 2026-01-28
77.3%
#12936: fix(telegram): omit message_thread_id for private DM chats
by omair445 · 2026-02-09
77.1%
#9734: fix(telegram): correct sender identification for channel messages (...
by divol89 · 2026-02-05
76.6%