Telegram error 400: Bad Request: can't use the media of the specified type in the album
Last verified against Telegram Bot API reference
Bad Request: can't use the media of the specified type in the albumWhat error 400 means
sendMediaGroup (or editMessageMedia on an album item) combined media types that cannot share an album. The server error is MEDIA_GROUPED_INVALID, described in Telegram's method docs as "You tried to send media of different types in an album", and the Bot API server rewrites it into this sentence.
The Bot API reference states the rule: documents and audio files can be only grouped in an album with messages of the same type. Photos and videos can be mixed with each other, but a document cannot sit next to a photo, and an audio file cannot sit next to a video. Editing one item of an existing photo album into a document fails for the same reason.
The media files themselves are fine. The fix is purely about how they are grouped, which usually means splitting one call into several.
What it looks like
{"ok":false,"error_code":400,"description":"Bad Request: can't use the media of the specified type in the album"}Why it happens
- An album mixes
InputMediaDocumentwith photos or videos. - An album mixes
InputMediaAudiowith any other type. editMessageMediachanged one album item to a type incompatible with the rest.- Files were classified by extension, so an image was sent as a document inside a photo album.
How to fix Telegram error 400
- 1Group items by type: one album for photos and videos, separate albums for documents and for audio.
- 2Send PDFs or other files as an album of documents only, or individually.
- 3When editing album items, keep the replacement in the same family as the original.
- 4Classify files by MIME type and choose the InputMedia class from that.
How to stop it recurring
Make your album builder partition files by type before sending, and order the resulting groups so the conversation still reads naturally. Decide the InputMedia class from the detected MIME type rather than the file extension, and cover mixed uploads in tests. Album size limits are covered under files and media 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?
sendMediaGroup (or editMessageMedia on an album item) combined media types that cannot share an album. The server error is MEDIA_GROUPED_INVALID , described in Telegram's method docs as "You tried to send media of different types in an album", and the Bot API server rewrites it into this sentence.
How do I fix Telegram error 400?
1. Group items by type: one album for photos and videos, separate albums for documents and for audio. 2. Send PDFs or other files as an album of documents only, or individually. 3. When editing album items, keep the replacement in the same family as the original. 4. Classify files by MIME type and choose the InputMedia class from that.
Stop debugging Telegram by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.