Telegram error 400: Bad Request: message caption is too long
Last verified against Telegram Bot API reference
Bad Request: message caption is too longWhat error 400 means
The caption on a photo, video, document, audio, animation or voice message exceeds the allowed length. The Bot API documents captions as 0-1024 characters after entities parsing on sendPhoto, sendVideo, sendDocument and the other media methods. Telegram's MTProto error MEDIA_CAPTION_TOO_LONG is rewritten by TDLib into this sentence.
"After entities parsing" matters. Markup characters such as *, _ or HTML tags do not count, but every visible character does, so a caption that looks short in your template may expand once variables are substituted. The limit for captions is a quarter of the 4096-character limit for text messages, which is the usual surprise when a bot moves long text from sendMessage into a photo caption.
The file itself is fine and the request will succeed once the caption is shortened.
What it looks like
{"ok":false,"error_code":400,"description":"Bad Request: message caption is too long"}Why it happens
- Long product descriptions or article bodies placed in a photo caption.
- Template variables expanding a caption past 1024 visible characters.
- Text that fit in
sendMessagemoved to a media method unchanged. editMessageCaptionappending content to an existing caption.
How to fix Telegram error 400
- 1Measure the caption after formatting and trim to 1024 characters with an ellipsis.
- 2Send the media with a short caption, then the full text as a follow-up
sendMessage(up to 4096 characters). - 3For albums, put the caption on one item only and keep it within the same limit.
- 4Re-test with the longest realistic values of each template variable.
How to stop it recurring
Enforce separate length budgets for text and captions in your message builder, measured after formatting is applied, and decide up front whether long content becomes a follow-up message. The text formatter shows the visible length of formatted text, and the documented numbers are under text and caption limits.
Official reference: Telegram Bot API reference. See all Telegram error codes or the Telegram limits and quotas.
Related codes
Error 400 - quick answers
What does Telegram error 400 mean?
The caption on a photo, video, document, audio, animation or voice message exceeds the allowed length. The Bot API documents captions as 0-1024 characters after entities parsing on sendPhoto , sendVideo , sendDocument and the other media methods. Telegram's MTProto error MEDIA_CAPTION_TOO_LONG is rewritten by TDLib into this sentence. "After entities parsing" matters.
How do I fix Telegram error 400?
1. Measure the caption after formatting and trim to 1024 characters with an ellipsis. 2. Send the media with a short caption, then the full text as a follow-up sendMessage (up to 4096 characters). 3. For albums, put the caption on one item only and keep it within the same limit. 4. Re-test with the longest realistic values of each template variable.
Should I retry after error 400?
No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.
Stop debugging Telegram by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.