ERROR – Error sending message to 6718717863: Message to be replied not found (aiogram)

I make my own echo bot that sends out a message to all bot users, kind of like an anonymous chat. (echo-to-all) I’m trying to add replies to it, and when i reply to my own message it’s fine, but if i try to reply to someone else’s message, i get an error: Message to be replied not found. Also, for some reason this reply is only visible to me. aiogram 2.25.1. MAIN ECHO FUNCTION:

@dp.message_handler(content_types=types.ContentType.ANY)
async def echo(msg: types.Message):
    global is_bot_closed
    current_time = time.time()
    
    if is_bot_closed and msg.from_user.id != ADMIN_ID:
        await msg.reply("Сейчас писать могут только админы.")
        return

    
    if msg.from_user.id in last_message_time:
        time_since_last_message = current_time - last_message_time[msg.from_user.id]
        time_remaining = MESSAGE_DELAY - time_since_last_message

        if time_remaining > 0:
            await msg.reply(f"Подождите еще {round(time_remaining, 1)} секунд.")
            return

    
    last_message_time[msg.from_user.id] = current_time

    
    if db.is_user_banned(msg.from_user.id):
        await msg.reply('Вы забанены и не можете использовать этого бота. Обратитесь к @cry4he1p')
        return

    if not db.sas(msg.from_user.id):
        await msg.reply('Сначала введите команду /start, чтобы начать взаимодействие с ботом.')
        return

    
    if msg.reply_to_message is not None:
        original_message_id = msg.reply_to_message.message_id
    else:
        original_message_id = None

    user_id = msg.from_user.id
    is_anon = db.get_anon_mode(user_id)
    show_link = db.get_show_link(user_id)

    x = db.get_ids()
    users = len(x)
    keyboard = create_keyboard(user_id, msg.from_user.first_name, anon=is_anon, show_link=show_link)
    reply_message = await msg.reply(f'Отправляю ваше сообщение {users} пользователям. (а может и нет..)')

    for i in x:
        try:
            zc = db.chek(i[0])
            if zc[0][0] == 1:
                try:
                    if msg.content_type == types.ContentType.TEXT:
                        await bot.send_message(chat_id=i[0], text=msg.text, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.PHOTO:
                        await bot.send_photo(chat_id=i[0], photo=msg.photo[-1].file_id, caption=msg.caption, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.AUDIO:
                        await bot.send_audio(chat_id=i[0], audio=msg.audio.file_id, caption=msg.caption, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.DOCUMENT:
                        await bot.send_document(chat_id=i[0], document=msg.document.file_id, caption=msg.caption, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.VIDEO:
                        await bot.send_video(chat_id=i[0], video=msg.video.file_id, caption=msg.caption, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.ANIMATION:
                        await bot.send_animation(chat_id=i[0], animation=msg.animation.file_id, caption=msg.caption, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.VOICE:
                        await bot.send_voice(chat_id=i[0], voice=msg.voice.file_id, caption=msg.caption, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.VIDEO_NOTE:
                        await bot.send_video_note(chat_id=i[0], video_note=msg.video_note.file_id, reply_markup=keyboard, reply_to_message_id=original_message_id)
                    elif msg.content_type == types.ContentType.STICKER:
                        await bot.send_sticker(chat_id=i[0], sticker=msg.sticker.file_id, reply_markup=keyboard, reply_to_message_id=original_message_id)
                except (BotBlocked, ChatNotFound, UserDeactivated):
                    logging.error(f"User {i[0]} has blocked the bot, the chat does not exist, or the user is deactivated. Skipping.")
                except aiogram.utils.exceptions.MessageToReplyNotFound:
                    logging.error(f'Message to reply to {original_message_id} not found for user {i[0]}. Skipping reply.')
                except Exception as e:
                    logging.error(f'Error sending message to {i[0]}: {e}')

                if not db.sas(msg.from_user.id):
                    await db.add(msg.from_user.id, msg.from_user.username)
        except Exception as e:
            logging.error(f'Error processing user {i[0]}: {e}')
          
    await asyncio.sleep(REPLY_MESSAGE_TIMEOUT)
    try:
        await bot.delete_message(chat_id=msg.chat.id, message_id=reply_message.message_id)
    except aiogram.utils.exceptions.MessageToDeleteNotFound:
        logging.error(f'Message to delete {reply_message.message_id} not found.')

I haven’t tried anything because I don’t know what

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật