← Back to PRs

#18533: fix(telegram): handle 'file is too big' error for large files

by MisterGuy420 open 2026-02-16 20:13 View on GitHub →
channel: telegram agents size: XS trusted-contributor
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