Telegram Bot "Message Is Not Modified" (400)? 5 Causes and the 4-Step No-Op Edit Guard
What does "Bad Request: message is not modified" mean in a Telegram bot?
It means your bot called editMessageText (or another edit method) with exactly the same text and the same inline keyboard the message already has, so Telegram had nothing to change and rejected the request with HTTP 400. The full description, as written in the open-source Telegram Bot API server, is "message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message". It is harmless to your users, but it fills logs and can crash a handler that treats every 400 as fatal. Auto X is a Telegram bot that schedules and auto-publishes your text and media posts to X, and we checked this against the Bot API reference and the server source on 2026-11-22.
Where the error comes from
Short answer: the Bot API server turns Telegram's internal MESSAGE_NOT_MODIFIED error into that 400 description. In the tdlib/telegram-bot-api source, the client code checks for MESSAGE_NOT_MODIFIED and replaces it with the long sentence above, and 400 errors are returned with the prefix "Bad Request: ".
The Bot API reference explains the response shape you will see: every response has a Boolean ok; when ok is false the error is explained in description, and an integer error_code is also returned, though Telegram says its contents are subject to change. So match on the description text, not only on the number 400.
| Field | Value for this error | How to use it |
|---|---|---|
ok | false | The edit did not run |
error_code | 400 | Telegram says the field's contents may change; don't rely on it alone |
description | Bad Request: message is not modified: ... | Match the "message is not modified" substring |
The 5 situations that trigger it
Short answer: something asked the bot to redraw a message that already shows the right content. These are the five patterns we check first:
- Double taps on an inline button. A user taps "Refresh" or the same page button twice; the second callback renders the same text and keyboard.
- A refresh with unchanged data. A status message is redrawn on a timer or button, but nothing in the underlying data changed since the last edit.
- A retry after a timeout. The first edit actually succeeded, your HTTP client timed out, and the retry sends the same content again.
- Two handlers editing one message. A callback handler and a background job both render the same final state.
- Editing only the keyboard with the same keyboard.
editMessageReplyMarkupwith markup identical to the current one hits the same rule, because the check compares content and reply markup.
The 4-step No-Op Edit Guard
The fix is to skip edits that would change nothing, and to treat this one error as success when it slips through. Our name for it is the No-Op Edit Guard:
- Answer the callback first. The Bot API says Telegram clients show a progress bar after a callback button is pressed until you call
answerCallbackQuery, so call it even when you will not edit anything. Our guide to an inline button that is not responding covers that step in detail. - Render, then compare. Build the new text and keyboard, then compare them with what you last sent for that
chat_idandmessage_id(keep the last rendered text and keyboard JSON, or a hash of both). If they match, return without calling the API. - Catch the specific 400. If the edit still fails and the description contains "message is not modified", log it at debug level and treat it as done. Every other 400, such as a parse error, stays an error.
- Make retries idempotent. Only retry edits on network errors or 429 responses, and before retrying, compare again. A timed-out edit that actually landed will then be skipped instead of producing this error.
# Python-style sketch of the guard
key = (chat_id, message_id)
new_state = (text, json.dumps(keyboard, sort_keys=True))
if last_rendered.get(key) == new_state:
return # nothing to change
resp = edit_message_text(chat_id, message_id, text, reply_markup=keyboard)
if not resp["ok"] and "message is not modified" in resp.get("description", ""):
pass # already up to date: treat as success
elif not resp["ok"]:
raise BotApiError(resp)
last_rendered[key] = new_state
What not to do
Short answer: don't hide every 400, and don't add invisible characters to force a change. A blanket "ignore 400" also hides real bugs, such as the can't parse entities error in MarkdownV2 or HTML or a text over the limit; editMessageText accepts 1 to 4096 characters after entity parsing, the same ceiling explained in our sendMessage over 4096 characters guide. Appending a zero-width space or a timestamp just to make the edit "different" turns a no-op into a real edit and burns API calls; if a timer redraws many messages, those calls also count toward the limits described in our Telegram rate limits and retry_after guide.
A worked example: a "Refresh queue" button
Illustrative scenario. A scheduling bot shows "3 posts queued" with a Refresh button. The user taps Refresh twice in a second. Without the guard, the first tap edits the message (or finds it unchanged) and the second tap returns "Bad Request: message is not modified", which an unguarded handler may log as a crash. With the guard, both taps are answered with answerCallbackQuery, the bot renders "3 posts queued" again, sees the stored state is identical and skips the edit. When a fourth post is added, the rendered text changes and the edit goes through. If your bot also mirrors edits to another platform, our note on syncing edited channel posts shows why tracking the last-sent state helps there too.
Auto X users never see this error: it only concerns bot developers. To schedule posts to X from Telegram, you can open the Auto X bot in Telegram or read how it works on the Auto X homepage.
FAQ
Is message is not modified a real failure?
No. The message already shows the requested text and keyboard, so nothing needed to change. Treat this exact description as success and keep every other 400 as an error.
Does editMessageReplyMarkup have the same error?
It can. The server's description covers content and reply markup together, so sending a keyboard identical to the current one is also a no-op that can return this 400.
Should I retry after this error?
No. Retrying the same edit returns the same error. Retry only on network failures or 429 responses, and compare the stored state before each retry.
Sources
- Telegram Bot API: updating messages, editMessageText and editMessageReplyMarkup (checked 2026-11-22)
- Telegram Bot API: making requests and the ok, description and error_code fields (checked 2026-11-22)
- Telegram Bot API: answerCallbackQuery (checked 2026-11-22)
- tdlib/telegram-bot-api source: MESSAGE_NOT_MODIFIED error mapping in Client.cpp (checked 2026-11-22)