# Bad Request: message can't be deleted / message to delete not found — Telegram bot error and how to fix it

> Bad 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.

Source: https://livops.dev/en/guides/error-telegram-message-cant-be-deleted

By Livops team, the people who build and run Livops. Updated 3 December 2026.

The errors, as the Telegram Bot API returns them:

```text
{"ok":false,"error_code":400,"description":"Bad Request: message can't be deleted"}
{"ok":false,"error_code":400,"description":"Bad Request: message can't be deleted for everyone"}
{"ok":false,"error_code":400,"description":"Bad Request: message to delete not found"}
```

Each library wraps them in its own words:

| Library | What you see |
| --- | --- |
| aiogram 3 | `TelegramBadRequest: Telegram server says - Bad Request: message can't be deleted`[7][8] |
| python-telegram-bot | `telegram.error.BadRequest: Message can't be deleted`[9][10] |
| grammY | `GrammyError: Call to 'deleteMessage' failed! (400: Bad Request: message can't be deleted)`[11] |
| Telegraf | `TelegramError: 400: Bad Request: message can't be deleted`[13] |

`message to delete not found` appears the same way in each library.

This page explains what the three texts mean, lists the rules Telegram applies to a bot's deletes, and shows how to delete inside them, how to catch the errors without hiding real bugs, and how to delete in batches with `deleteMessages` — in aiogram, python-telegram-bot, grammY and Telegraf. It ends with keeping scheduled deletes across a deploy on Livops.

## What do the errors mean?

- **`message to delete not found`** — the Bot API server looks the message up before it deletes it. If `message_id` is missing or zero, if the bot has no access to the chat's messages, or if there is no such message, it answers with this text[5]. There is nothing to delete.
- **`message can't be deleted`** — the message was found, but the bot may not delete it. TDLib checks this before the request leaves[6]; when Telegram's own servers refuse instead, with `MESSAGE_DELETE_FORBIDDEN`, the Bot API server turns that into the same text[5]. Telegram describes that code as "most likely because it is a service message"[3][4].
- **`message can't be deleted for everyone`** — the same refusal for a private chat or a basic group. A bot's delete always removes the message for everyone[5], and TDLib answers with this text when it can't[6].

All three are 400s. Telegram says the numeric `error_code` may change in the future[1], so match on the description.

## Which messages can a bot delete?

The `deleteMessage` documentation lists the limits[1]:

- A message can only be deleted if it was sent less than 48 hours ago.
- Service messages about a supergroup, channel, or forum topic creation can't be deleted.
- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats.
- Bots granted `can_post_messages` permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has the `can_delete_messages` administrator right in a supergroup or a channel, it can delete any message there.
- If the bot has the `can_manage_direct_messages` administrator right in a channel, it can delete any message in the corresponding direct messages chat.

`can_delete_messages` is the administrator right to delete messages of other users[1].

## Message can't be deleted: causes

### 1. The message is older than 48 hours

The most common one, and no right lifts it[1]. In TDLib's check, a bot can't delete a supergroup or channel message older than two days, which gives `message can't be deleted`; in a private chat or a basic group the limit comes through the delete-for-everyone rule, which in TDLib's code is two days by default for bots (the server can set it), which gives `message can't be deleted for everyone`[6].

A cleanup job that runs once a day, or a bot that was down for two days, hits this for everything it missed.

### 2. Someone else's message, without the right

In a supergroup, the bot can delete another user's message only with `can_delete_messages`; in a basic group, only as an administrator[1]. Without it you get `message can't be deleted` in a supergroup and `message can't be deleted for everyone` in a basic group[6]. Promote the bot with the right to delete messages. To check what it has now, call `getChatMember` with the bot's own id.

### 3. A channel post without can_post_messages

In a channel, the bot deletes its own posts only if it was granted `can_post_messages`[1].

### 4. A service message that can't go

The service messages about creating the supergroup, channel or forum topic can't be deleted[1]. A dice in a private chat is the reverse: it can be deleted only after 24 hours[1].

## Message to delete not found: causes

### 1. It was already deleted

The usual case. The user deleted their message first, an administrator removed it, or your own code deleted it twice — two handlers on the same update, or a cleanup task retrying after a timeout. The message you wanted gone is gone, so this is safe to treat as success.

### 2. The ids belong to different messages

`message_id` is unique only inside its chat[1]. Take `chat_id` and `message_id` from the same message — the one a send method returned, or the one an update carries. More on mismatched pairs in [message to edit not found](https://livops.dev/en/guides/error-telegram-message-to-edit-not-found), which comes from the same lookup[5].

### 3. message_id is missing or zero

The Bot API server reads a `message_id` that is missing or not positive as no message at all[5]. Check for `None`, `undefined` or `0` coming from a database row.

### 4. The bot left the supergroup

In a supergroup the server checks that the bot is still a member before it looks at the message[5]. If it was removed, sends there fail too: see [bot was kicked from the group chat](https://livops.dev/en/guides/error-telegram-bot-was-kicked-from-the-group-chat).

## Catch the errors safely

Treat `not found` as done, log `can't be deleted` and move on, and raise everything else. Do not retry either one: the same request gets the same answer.

**aiogram 3.** A 400 from Telegram is `TelegramBadRequest`, with Telegram's description in `message`[7][8]:

```python
import logging

from aiogram import Bot
from aiogram.exceptions import TelegramBadRequest


async def safe_delete(bot: Bot, chat_id: int, message_id: int) -> bool:
    try:
        return await bot.delete_message(chat_id, message_id)
    except TelegramBadRequest as e:
        if "message to delete not found" in e.message:
            return False  # already gone
        if "message can't be deleted" in e.message:  # also matches "... for everyone"
            logging.warning("can't delete %s/%s: %s", chat_id, message_id, e.message)
            return False
        raise
```

**python-telegram-bot.** A 400 is `BadRequest`; the library removes `Bad Request: ` and capitalizes the rest, so compare in lower case[9][10]:

```python
import logging

from telegram.error import BadRequest


async def safe_delete(bot, chat_id: int, message_id: int) -> bool:
    try:
        return await bot.delete_message(chat_id, message_id)
    except BadRequest as e:
        text = e.message.lower()
        if "message to delete not found" in text:
            return False
        if "message can't be deleted" in text:
            logging.warning("can't delete %s/%s: %s", chat_id, message_id, e.message)
            return False
        raise
```

**grammY.** API errors are `GrammyError`, with Telegram's `description`[11][12]:

```ts
import { GrammyError } from "grammy";

const IGNORED = /message to delete not found|message can't be deleted/;

async function safeDelete(chatId: number, messageId: number): Promise<boolean> {
  try {
    return await bot.api.deleteMessage(chatId, messageId);
  } catch (e) {
    if (e instanceof GrammyError && IGNORED.test(e.description)) return false;
    throw e;
  }
}
```

**Telegraf.** API errors are `TelegramError`, with a `description` getter[13][14]:

```ts
import { TelegramError } from "telegraf";

const IGNORED = /message to delete not found|message can't be deleted/;

async function safeDelete(chatId: number, messageId: number): Promise<boolean> {
  try {
    return await bot.telegram.deleteMessage(chatId, messageId);
  } catch (e) {
    if (e instanceof TelegramError && IGNORED.test(e.description)) return false;
    throw e;
  }
}
```

## Deleting many messages: deleteMessages

`deleteMessages` deletes several messages in one request: 1-100 ids, with the same limits as `deleteMessage`, and ids that can't be found are skipped[1]. It came with Bot API 7.0[2]. aiogram has `bot.delete_messages`, python-telegram-bot `bot.delete_messages`, grammY `bot.api.deleteMessages` and Telegraf `bot.telegram.deleteMessages`[12][14].

Two details from the server's code:

- **Missing ids are not an error.** The Bot API server looks the ids up and drops those it can't find[5], so `deleteMessages` with ids that are already gone should still return `True`. The membership check still applies: a bot that is no longer in the supergroup gets `message to delete not found`[5].
- **One refused message can fail the whole request.** In TDLib's code, it checks every message first and returns `message can't be deleted` (or `... for everyone`) for the request if any one of them can't be deleted[6]. Fall back to one at a time for that batch.

```python
# aiogram 3
async def delete_many(bot: Bot, chat_id: int, message_ids: list[int]) -> None:
    for i in range(0, len(message_ids), 100):
        batch = message_ids[i : i + 100]
        try:
            await bot.delete_messages(chat_id, batch)
        except TelegramBadRequest as e:
            if "message can't be deleted" not in e.message:
                raise
            for message_id in batch:  # find the ones that can go
                await safe_delete(bot, chat_id, message_id)
```

The fallback can send up to 100 requests in a row; if Telegram answers with a 429, wait as it asks — see [Telegram 429: Too Many Requests](https://livops.dev/en/guides/error-telegram-429-too-many-requests).

## Delete inside the 48 hours

If your bot cleans up after itself — a "Processing…" message, a captcha, a reminder — delete it while it is young, and keep the plan somewhere that outlives the process. A timer in memory dies with the process, and a message whose delete was due before a restart may be past 48 hours by the time anyone notices.

Store `chat_id`, `message_id` and the time to delete in a table, and let a loop delete what is due:

```python
import asyncio
import os
import sqlite3
import time

db = sqlite3.connect(os.path.join(os.environ.get("DATA_DIR", "."), "deletes.db"))
db.execute("CREATE TABLE IF NOT EXISTS deletes (chat_id INTEGER, message_id INTEGER, due INTEGER)")


def delete_later(chat_id: int, message_id: int, seconds: int) -> None:
    db.execute("INSERT INTO deletes VALUES (?, ?, ?)", (chat_id, message_id, int(time.time()) + seconds))
    db.commit()


async def delete_loop(bot) -> None:
    while True:
        now = int(time.time())
        for chat_id, message_id in db.execute("SELECT chat_id, message_id FROM deletes WHERE due <= ?", (now,)).fetchall():
            await safe_delete(bot, chat_id, message_id)
            db.execute("DELETE FROM deletes WHERE chat_id = ? AND message_id = ?", (chat_id, message_id))
            db.commit()
        await asyncio.sleep(10)
```

Start `delete_loop` with `asyncio.create_task(delete_loop(bot))` next to your polling. Because `safe_delete` treats `not found` and `can't be deleted` as done, a row never loops forever.

## On Livops

These errors happen while the bot runs, when it deletes a message; a deploy does not delete anything, so it can be green while a delete fails.

- **Logs.** The warning lines from `safe_delete` and any uncaught error are on the project's **Logs** page, and `livops logs <service> -f` follows them from the terminal; see [CLI](https://livops.dev/en/docs/cli). Over [MCP](https://livops.dev/en/docs/mcp), `get_logs` returns up to 5000 lines.
- **Scheduled deletes survive a deploy.** A bot's old version is stopped before the new one starts (see [The app did not start](https://livops.dev/en/docs/error-start)), so timers held in memory are lost on every deploy. The project's disk at `/app/data` is kept across deploys and restarts, and its path is in `DATA_DIR`, which is why the example builds the SQLite path from it; see [Files and data](https://livops.dev/en/docs/files). If a separate worker does the deleting, keep the table in PostgreSQL instead: add one under **Databases**, and `DATABASE_URL` is written into every service in the environment, including ones added later.
- **Ship the fix with a push.** Every `git push` to 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](https://livops.dev/en/docs/pricing).

## Questions

**Why does deleteMessage say message can't be deleted?**

Telegram found the message but your bot may not delete it. The usual reasons: it was sent more than 48 hours ago, it is another user's message in a supergroup and the bot has no can_delete_messages right, or it is a service message about creating the group, channel or topic.

**Can a bot delete messages older than 48 hours?**

No. The Bot API documents that a message can only be deleted if it was sent less than 48 hours ago, and no admin right lifts that. If a message must go later, delete it before the 48 hours are up, or edit it instead.

**Can a bot delete other users' messages in a group?**

Yes, with the right rights. In a basic group the bot must be an administrator. In a supergroup or channel it needs the can_delete_messages administrator right. In a private chat it can delete the user's messages without any right.

**Is it safe to ignore message to delete not found?**

Usually yes. The message you wanted gone is already gone, often because a user or another handler deleted it first. Log it at a low level so a wrong chat_id and message_id pair still shows up in the logs.

**What does message can't be deleted for everyone mean?**

It is the same refusal from a private chat or a basic group. A bot always deletes for everyone, so when the message is too old, or in a basic group it is another user's message and the bot is not an administrator, the Bot API answers with this text.

**How do I delete many messages at once?**

Use deleteMessages with 1 to 100 message ids. Ids that can't be found are skipped. But in TDLib's code one message that can't be deleted can fail the whole request, so fall back to deleting that batch one message at a time.

## Sources

1. [Telegram Bot API — Making requests, deleteMessage, deleteMessages, ChatAdministratorRights](https://core.telegram.org/bots/api). Checked 3 December 2026.
2. [Telegram Bot API — Changelog (Bot API 7.0)](https://core.telegram.org/bots/api-changelog). Checked 3 December 2026.
3. [Telegram API — error database (errors.json)](https://core.telegram.org/api/errors.json). Checked 3 December 2026.
4. [Telegram API — messages.deleteMessages](https://core.telegram.org/method/messages.deleteMessages). Checked 3 December 2026.
5. [Telegram Bot API server source — telegram-bot-api/Client.cpp](https://raw.githubusercontent.com/tdlib/telegram-bot-api/master/telegram-bot-api/Client.cpp). Checked 3 December 2026.
6. [TDLib source — td/telegram/MessagesManager.cpp](https://raw.githubusercontent.com/tdlib/td/master/td/telegram/MessagesManager.cpp). Checked 3 December 2026.
7. [aiogram source — aiogram/exceptions.py](https://raw.githubusercontent.com/aiogram/aiogram/dev-3.x/aiogram/exceptions.py). Checked 3 December 2026.
8. [aiogram source — aiogram/client/session/base.py](https://raw.githubusercontent.com/aiogram/aiogram/dev-3.x/aiogram/client/session/base.py). Checked 3 December 2026.
9. [python-telegram-bot source — telegram/error.py](https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/src/telegram/error.py). Checked 3 December 2026.
10. [python-telegram-bot source — telegram/request/_baserequest.py](https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/src/telegram/request/_baserequest.py). Checked 3 December 2026.
11. [grammY source — src/core/error.ts](https://raw.githubusercontent.com/grammyjs/grammY/main/src/core/error.ts). Checked 3 December 2026.
12. [grammY source — src/core/api.ts](https://raw.githubusercontent.com/grammyjs/grammY/main/src/core/api.ts). Checked 3 December 2026.
13. [Telegraf source — src/core/network/error.ts](https://raw.githubusercontent.com/telegraf/telegraf/v4/src/core/network/error.ts). Checked 3 December 2026.
14. [Telegraf source — src/telegram.ts](https://raw.githubusercontent.com/telegraf/telegraf/v4/src/telegram.ts). Checked 3 December 2026.
