Telegram Bot API · error code

Telegram error 400: Bad Request: message can't be edited

Permanent - do not retryHTTP 400400 Bad Request: identifiers, content and rights

Last verified against Telegram Bot API reference

What Telegram returns
Bad Request: message can't be edited

What error 400 means

An editMessageText, editMessageCaption, editMessageMedia or editMessageReplyMarkup call targeted a message the bot is not permitted to change. Bots may only edit messages they sent themselves (or inline messages they produced via inline_message_id); they cannot edit a user's message, a forwarded copy, or most service messages. The Bot API also documents that business messages not sent by the bot and without an inline keyboard can only be edited within 48 hours of being sent.

This is different from message to edit not found, which means the ID does not resolve, and from message is not modified, which means the edit was a no-op. Here the message was found and the content differed; Telegram simply will not let this bot change it.

Poll messages are another case: once a poll is sent its question and options cannot be edited, only stopped with stopPoll. Channel posts add a rights dimension: editing a post in a channel requires the bot to be an administrator with can_edit_messages, and losing that right turns previously working edits into this error overnight.

python-telegram-bot raises telegram.error.BadRequest and aiogram v3 raises TelegramBadRequest with this description; there is no dedicated exception class, so match on the description string. The most common real-world trigger in all stacks is the same: a handler that stores the wrong message reference (the user's incoming message instead of the bot's own reply) and later tries to edit it. Verify from.id on the stored message equals your bot's own ID from getMe.

What it looks like

{"ok":false,"error_code":400,"description":"Bad Request: message can't be edited"}

Why it happens

  • The message was sent by a user or by a different bot, not by this bot.
  • The message is a forward, a poll, a dice, or a service message.
  • The bot is trying to edit a channel post without the can_edit_messages admin right.
  • The message is a business message outside the 48-hour edit window.
  • The stored message_id points at the user's message instead of the bot's reply.

How to fix Telegram error 400

  1. 1Confirm from.id on the stored message equals your bot's ID (getMe).
  2. 2For channel posts, give the bot the can_edit_messages right and retry.
  3. 3If the content is a poll, call stopPoll and send a new one instead of editing.
  4. 4Store the return value of your own send call (it contains the bot's message_id) and edit that, never the triggering message.
  5. 5Fall back to sending a fresh message when an edit is refused, and keep the user experience consistent.

How to stop it recurring

Only store message IDs for editing when the message came from your own send call. Avoid 'edit the user's message' designs entirely; they are impossible in the Bot API. In channels, check admin rights at setup rather than at the moment of the first edit. The documented edit windows and content-type constraints are collected under editing and deleting 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?

An editMessageText , editMessageCaption , editMessageMedia or editMessageReplyMarkup call targeted a message the bot is not permitted to change. Bots may only edit messages they sent themselves (or inline messages they produced via inline_message_id ); they cannot edit a user's message, a forwarded copy, or most service messages.

How do I fix Telegram error 400?

1. Confirm from.id on the stored message equals your bot's ID ( getMe ). 2. For channel posts, give the bot the can_edit_messages right and retry. 3. If the content is a poll, call stopPoll and send a new one instead of editing. 4. Store the return value of your own send call (it contains the bot's message_id) and edit that, never the triggering message. 5. Fall back to sending a fresh message when an edit is refused, and keep the user experience consistent.

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.