Bad Request: message to be replied not found — Telegram bot error and how to fix it
Bad Request: message to be replied not found means Telegram could not find the message your bot tried to reply to, so nothing was sent: it was deleted, its message_id belongs to another chat or forum topic, or the bot cannot see that chat. Pass reply_parameters with allow_sending_without_reply set to true to send the message anyway, take the message_id from the same chat, and catch the error where the reply is optional.
By Livops team, the people who build and run LivopsUpdated
The error, as the Telegram Bot API returns it[3]:
{"ok":false,"error_code":400,"description":"Bad Request: message to be replied not found"}
Each library wraps it in its own words:
| Library | What you see |
|---|---|
| aiogram 3 | TelegramBadRequest: Telegram server says - Bad Request: message to be replied not found[7][8] |
| python-telegram-bot | telegram.error.BadRequest: Message to be replied not found[12][13] |
| grammY | GrammyError: Call to 'sendMessage' failed! (400: Bad Request: message to be replied not found)[18] |
| Telegraf | TelegramError: 400: Bad Request: message to be replied not found[21] |
Older versions of the Bot API server worded the same error differently, and old answers and issues still quote them:
| Description | In the server’s source |
|---|---|
Bad Request: reply message not found |
When it was first published, in November 2020[6] |
Bad Request: replied message not found |
Later versions, until October 2023[4] |
Bad Request: message to reply not found |
October 2023 to May 2024[4][5] |
Bad Request: message to be replied not found |
Since May 2024[5] |
This page explains when the Bot API server gives this error, the causes from the most common, and the fixes — allow_sending_without_reply, the right chat and topic, and catching the error — in aiogram, python-telegram-bot, grammY and Telegraf. It ends with how to find the failing send on Livops.
What does the error mean?
Every send method can send its message as a reply: you pass reply_parameters, whose message_id is the message to reply to in the current chat, or in the chat named by its own chat_id[1]. Before it sends anything, the Bot API server looks that message up[3]:
- If the message would be in a supergroup or channel the bot is not a member of, the bot cannot see its messages, and the server answers
message to be replied not foundstraight away[3]. - Otherwise it asks for the message. If there is none and
allow_sending_without_replyis not set, it answers with this error; if it is set, the message goes out as a normal message, not a reply[3]. allow_sending_without_replyis always false for replies in another chat or forum topic[1]. There, a missing message is an error whatever you pass.
So the whole message failed, not just the reply. It is a 400, and Telegram says the numeric error_code may change in the future[1], so match on the description.
reply_to_message_id is now reply_parameters
Bot API 7.0, on December 29, 2023, replaced the reply_to_message_id and allow_sending_without_reply parameters of the send methods with one field, reply_parameters[2]. The Bot API server still reads the two old parameters when reply_parameters is absent; when reply_parameters is present, it reads only that[3]. A request that sets reply_parameters and a top-level allow_sending_without_reply therefore loses the flag. The documentation now lists only reply_parameters[1].
Causes, most common first
1. The message was deleted before the reply
The user deleted their message, an administrator or an anti-spam bot removed it, or your own code did — a bot that deletes a command to keep the group clean and then replies to it without the flag meets this error every time. A slow handler, such as one that waits for a payment check or a language model, gives a deletion more time to happen. The server finds no message[3].
Fix: send with allow_sending_without_reply: true (below), or reply first and delete afterwards.
2. The message_id is from another chat
A message_id is unique only inside its chat[1]. Message 42 in a private chat has nothing to do with message 42 in your admin group. The usual mistake: the bot forwards a user’s question to an admin group and replies there with the id of the user’s original message. The server looks for that id in the admin group: if there is no such message there, it gives this error[3].
Fix: reply in the chat the message is in. To reply across chats on purpose, put the original chat in reply_parameters.chat_id; Bot API 7.0 added replies to messages in other chats and forum topics[2]. Then allow_sending_without_reply is always false[1], and in a supergroup or channel the bot must be a member to see the message[3].
3. The message is in another forum topic
In a forum supergroup, the target topic is the send method’s message_thread_id[1]. Sending into topic A as a reply to a message in topic B is a reply in another forum topic[2], so allow_sending_without_reply is always false[1] and a deleted message in topic B fails even with the flag. Fix: send into the topic the message is in. The reply shortcuts do that for you: aiogram’s message.reply sets the thread when the message is a topic message[11], and so do grammY’s ctx.reply[19] and Telegraf’s ctx.reply[22].
4. The bot is not in the chat the message is in
When reply_parameters.chat_id names a supergroup or channel the bot is not a member of, the server answers this error before it looks for the message, whatever allow_sending_without_reply says[3]. Fix: add the bot to that chat, or reply without chat_id. Sending to such a chat fails differently; see bot is not a member of the channel chat.
How to fix it
Send anyway: allow_sending_without_reply
With the raw Bot API, reply_parameters is a JSON object[1][3]:
curl -s "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" \
--data-urlencode "chat_id=$CHAT_ID" \
--data-urlencode "text=Done" \
--data-urlencode 'reply_parameters={"message_id":42,"allow_sending_without_reply":true}'
aiogram 3. ReplyParameters.allow_sending_without_reply takes the bot’s default when you leave it out[9], and DefaultBotProperties has an allow_sending_without_reply default[10]. message.reply builds its ReplyParameters with that default[11], so one line covers every reply:
from aiogram import Bot
from aiogram.client.default import DefaultBotProperties
from aiogram.types import ReplyParameters
bot = Bot(token=TOKEN, default=DefaultBotProperties(allow_sending_without_reply=True))
# or for one message
await message.answer(
"Done",
reply_parameters=ReplyParameters(message_id=message.message_id, allow_sending_without_reply=True),
)
python-telegram-bot 21 and later. ReplyParameters takes message_id, chat_id and allow_sending_without_reply[14]. send_message still accepts reply_to_message_id and allow_sending_without_reply as keyword-only convenience arguments, but not together with reply_parameters[15]. Defaults(allow_sending_without_reply=True) is used for ReplyParameters.allow_sending_without_reply[16], and the application builder takes it with .defaults()[17]:
from telegram import ReplyParameters
from telegram.ext import ApplicationBuilder, Defaults
app = ApplicationBuilder().token(TOKEN).defaults(Defaults(allow_sending_without_reply=True)).build()
# or for one message
await context.bot.send_message(
chat_id=update.effective_chat.id,
text="Done",
reply_parameters=ReplyParameters(
message_id=update.effective_message.message_id,
allow_sending_without_reply=True,
),
)
grammY. ctx.reply passes your options to sendMessage[19], and its types include reply_parameters with allow_sending_without_reply[20]:
bot.on("message", async (ctx) => {
await ctx.reply("Done", {
reply_parameters: { message_id: ctx.msg.message_id, allow_sending_without_reply: true },
});
});
Telegraf. ctx.reply is sendMessage to the current chat[22]. Telegraf 4.16.3 depends on @telegraf/types 7.1[23], whose ReplyParameters has message_id and allow_sending_without_reply[24]:
bot.on("message", async (ctx) => {
await ctx.reply("Done", {
reply_parameters: { message_id: ctx.message.message_id, allow_sending_without_reply: true },
});
});
Catch the error where the reply is optional
Where you cannot use the flag — a reply in another chat or topic — catch this one error, send without the reply, and raise everything else.
aiogram 3. Telegram’s 400 is TelegramBadRequest, with Telegram’s description in message[7][8]:
from aiogram.exceptions import TelegramBadRequest
from aiogram.types import ReplyParameters
try:
await bot.send_message(chat_id, text, reply_parameters=ReplyParameters(message_id=reply_id))
except TelegramBadRequest as e:
if "message to be replied not found" not in e.message:
raise
await bot.send_message(chat_id, text)
python-telegram-bot. Telegram’s 400 is BadRequest; the library removes Bad Request: and capitalizes the rest, so compare in lower case[12][13]:
from telegram import ReplyParameters
from telegram.error import BadRequest
try:
await context.bot.send_message(chat_id, text, reply_parameters=ReplyParameters(message_id=reply_id))
except BadRequest as e:
if "message to be replied not found" not in e.message.lower():
raise
await context.bot.send_message(chat_id, text)
grammY. API errors are GrammyError, with Telegram’s description[18]:
import { GrammyError } from "grammy";
try {
await bot.api.sendMessage(chatId, text, { reply_parameters: { message_id: replyId } });
} catch (e) {
if (!(e instanceof GrammyError && e.description.includes("message to be replied not found"))) throw e;
await bot.api.sendMessage(chatId, text);
}
Telegraf. API errors are TelegramError, with a description getter[21]:
import { TelegramError } from "telegraf";
try {
await bot.telegram.sendMessage(chatId, text, { reply_parameters: { message_id: replyId } });
} catch (e) {
if (!(e instanceof TelegramError && e.description.includes("message to be replied not found"))) throw e;
await bot.telegram.sendMessage(chatId, text);
}
Keep the chat, topic and message together
Reply with the library’s shortcut on the message you received (message.reply, ctx.reply with that message’s id), so the chat and topic come from the same message. If you store a message to reply to later, store its chat id, topic and message id together, and pass chat_id in reply_parameters when the reply goes to a different chat.
On Livops
This error happens while the bot runs, when it sends a reply; a deploy does not send your bot’s messages, so it can be green while a reply fails.
- Logs. The error line is on the project’s Logs page, and
livops logs <service> -ffollows it from the terminal; see CLI. Log thechat_id, the topic and themessage_idyou replied to next to it, so you can tell a deleted message from an id from another chat. Over MCP,get_logsreturns up to 5000 lines. - If it stops the bot right after a deploy. If an uncaught error stops the bot right after it starts — for example, replying to a stored message that has since been deleted — the deploy fails as
start_failed, with the bot’s last words on the Logs page. A bot’s old version is stopped before the new one starts, so the bot is down until a deploy succeeds. See The app did not start. - Ship the fix with a push. Every
git pushto the project’s branch starts a new deploy; push the fix, and the new version replaces the old one.
A bot costs 19 credits a month (19,000 so’m); see Pricing.
Questions
What does message to be replied not found mean?
Your bot sent a message as a reply, and the Bot API server could not find the message it was meant to reply to. Usually it was deleted, or its message_id belongs to another chat or forum topic. Nothing was sent, not even the text without the reply.
How do I send the message even if the original was deleted?
Pass reply_parameters with the message_id and allow_sending_without_reply set to true. Telegram then sends a normal message when the original is gone. In aiogram you can make it the default with DefaultBotProperties, and in python-telegram-bot with Defaults.
Where did reply_to_message_id go?
Bot API 7.0, in December 2023, replaced the reply_to_message_id and allow_sending_without_reply parameters of the send methods with one field, reply_parameters. The Bot API server still reads the old parameters when reply_parameters is missing, but the documentation lists only reply_parameters.
Why does allow_sending_without_reply not help?
It is always false for a reply to a message in another chat or another forum topic, so a deleted message there still fails. The server also fails a reply in a supergroup or channel the bot is not a member of before it looks at the flag. And if you pass reply_parameters, a top-level allow_sending_without_reply is ignored.
How is it different from message to edit not found?
Both mean the server could not find a message by its id. Message to edit not found comes from the edit methods, when the bot changes a message already in the chat. Message to be replied not found comes from the send methods, when the bot sends a new message as a reply.
Is reply message not found the same error?
Yes, in older wording. The Bot API server's source said reply message not found when it was first published in 2020, later replied message not found, then message to reply not found from October 2023, and message to be replied not found since May 2024.
Sources
- Telegram Bot API — Making requests, sendMessage, ReplyParameters, Message (core.telegram.org). Checked .
- Telegram Bot API — Changelog (Bot API 7.0, Replies 2.0) (core.telegram.org). Checked .
- Telegram Bot API server source — telegram-bot-api/Client.cpp (raw.githubusercontent.com). Checked .
- Telegram Bot API server — commit 9a7a293 (31 October 2023), replied message renamed to message to reply (github.com). Checked .
- Telegram Bot API server — commit a5a1c50 (3 May 2024), message to reply renamed to message to be replied (github.com). Checked .
- Telegram Bot API server source as first published (3 November 2020) — telegram-bot-api/Client.cpp (github.com). Checked .
- aiogram source — aiogram/exceptions.py (raw.githubusercontent.com). Checked .
- aiogram source — aiogram/client/session/base.py (raw.githubusercontent.com). Checked .
- aiogram source — aiogram/types/reply_parameters.py (raw.githubusercontent.com). Checked .
- aiogram source — aiogram/client/default.py (raw.githubusercontent.com). Checked .
- aiogram source — aiogram/types/message.py (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/error.py (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/request/_baserequest.py (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/_reply.py (ReplyParameters) (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/_bot.py (send_message) (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/ext/_defaults.py (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/ext/_applicationbuilder.py (raw.githubusercontent.com). Checked .
- grammY source — src/core/error.ts (raw.githubusercontent.com). Checked .
- grammY source — src/context.ts (raw.githubusercontent.com). Checked .
- grammY types source — message.ts (ReplyParameters) (raw.githubusercontent.com). Checked .
- Telegraf source — src/core/network/error.ts (raw.githubusercontent.com). Checked .
- Telegraf source — src/context.ts (raw.githubusercontent.com). Checked .
- Telegraf 4.16.3 — package.json (github.com). Checked .
- @telegraf/types v7.1.0 source — message.ts (ReplyParameters) (github.com). Checked .
Put your project online today
Connect GitHub or drop a folder. No card is asked for.
Deploy your botRelated
- Bad Request: message to edit not found / message can't be edited — Telegram bot error and how to fix itBad Request: message to edit not found means Telegram has no message with that message_id in that chat for your bot: the pair is wrong, the message was deleted, or the bot left the group. Bad Request: message can't be edited means the message exists but the bot may not edit it, usually because the bot did not send it. Edit only messages the bot sent, take both ids from the same message, and use inline_message_id for inline messages.
- Bad Request: message can't be deleted / message to delete not found — Telegram bot error and how to fix itBad Request: message can't be deleted means the message exists but your bot may not delete it: it is older than 48 hours, it belongs to someone else and the bot lacks the right, or it is a service message that can't be removed. Bad Request: message to delete not found means it is already gone or the chat_id and message_id do not match. Delete within 48 hours, give the bot can_delete_messages, and catch both errors.
- Telegram 400: Bad Request: chat not found — how to fix itThe bot asked Telegram for a chat it does not know. Either the chat_id is wrong (a typo, a channel id without its -100 prefix, a user's @username, an id cut to 32 bits), or it is right but this bot has never been in that chat: the user never pressed Start, the bot was never added to the group or channel, or the token belongs to a different bot.
- Telegram 403: Forbidden: bot is not a member of the channel chat — how to fix itTelegram knows the channel, but your bot is not in it, so every send, edit or delete there fails with a 403. Usually the bot was never added (a public channel is found by its @username even so), it left with leaveChat, it was removed and then unbanned, or the token belongs to a different bot. Add the bot to the channel as an administrator that can post messages. The same error exists for supergroups and groups.
- Telegram 400: Bad Request: group chat was upgraded to a supergroup chat — how to fix itThe group your bot writes to was upgraded to a supergroup, and the supergroup has a new chat id: the old one no longer takes messages. The error carries the new id in parameters.migrate_to_chat_id. Save it in place of the old id and send again, and handle the migrate_to_chat_id service message so the id is updated before the next send fails.
- Telegram bot hosting in 2026: the options comparedA Telegram bot needs a process that never stops, or a public HTTPS address for a webhook. On Livops it runs from a GitHub push for 19 credits a month (19,000 so'm). Here is how a VPS, Railway, Render, Fly.io and Vercel compare.
- aiogram bot hosting: how to deploy an aiogram 3 botAn aiogram 3 bot needs one process that never stops, the token in an environment variable, state kept outside memory and a clean exit on SIGTERM. On Livops you push a repository with bot.py and requirements.txt, and it runs for 19 credits a month (19,000 so'm), polling or webhook.
- python-telegram-bot hosting: deploying a v22 botA python-telegram-bot bot runs as one Application: run_polling() for polling, run_webhook() with the webhooks extra for a webhook. Both stop cleanly on SIGTERM. On Livops it runs from a push with bot.py and requirements.txt for 19 credits a month (19,000 so'm).
- grammY bot deploy: polling, webhooks and hostingDeploy a grammY bot as one always-on Node.js process: bot.start() for polling, or webhookCallback() behind an HTTP server, with bot.stop() on SIGTERM. On Livops a repository with grammy in package.json runs as a bot from every push, for 19 credits a month (19,000 so'm).
- Telegraf bot hosting: deploying a Telegraf 4 bot on Node.jsA Telegraf bot is one Node.js process: bot.launch() for polling, or bot.webhookCallback() behind an HTTP server for a webhook, with bot.stop() on SIGTERM. On Livops a repository with telegraf in package.json is run as a bot from every push, for 19 credits a month (19,000 so'm).