aiogram 3 suddenly started giving an error

I created the bot using aiogram 3.4.1 and it worked well. I left the project for two months and returned to it recently. When calling any menu, the bot gives an error:

aiogram.exceptions.TelegramBadRequest: Telegram server says - Bad Request: can't parse entities: Unsupported start tag "" at byte offset

Next are lines about dispatcher errors:

Traceback (most recent call last):
  File "/Users/.../lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 309, in _process_update
    response = await self.feed_update(bot, update, **kwargs)
  File "/Users/.../lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 158, in feed_update
    response = await self.update.wrap_outer_middleware(
  File "/Users/.../lib/python3.10/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in __call__
    return await handler(event, data)
... and more

I have tried other versions of aiogram. I changed the quotes in the menu item definitions to single ones. Nothing helped. Search didn’t help me too.

Please help me to understand what the problem is it, because the bot worked well before, and I don’t want to completely rewrite it.

main.py

from aiogram import Bot, Dispatcher
from aiogram.enums import ParseMode
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram.client.bot import DefaultBotProperties

async def main() -> None:
    bot = Bot(API_TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
    dp = Dispatcher(storage=MemoryStorage())
    dp.include_router(common.router)

    await bot.delete_webhook(drop_pending_updates=True)
    await dp.start_polling(bot)

if __name__ == "__main__":
    asyncio.run(main())

common.py

from aiogram import F, Router
from aiogram.filters import Command
from aiogram.fsm.context import FSMContext
from aiogram.types import Message

from handlers.keyboard import start_keyboard
from handlers import add_hand
from handlers import manage_hand
from handlers import count_hand
from handlers import service_hand

from config import admins

router = Router()

router.include_router(add_hand.router)
router.include_router(manage_hand.router)
router.include_router(count_hand.router)
router.include_router(service_hand.router)

@router.message(F.from_user.id.in_(admins), Command(commands=["start"]))
async def cmd(message: Message, state: FSMContext):
    await state.clear()
    keyboard=start_keyboard()
    await message.answer(
        text="Choose action",
        reply_markup=keyboard
    )
    
@router.message(Command(commands=["cancel"]))
@router.message(F.text.lower() == "back")
async def cmd(message: Message, state: FSMContext):
    await state.clear()
    keyboard=start_keyboard()
    await message.answer(
        text="Choose action",
        reply_markup=keyboard
    )

keyboard.py

from aiogram.types import ReplyKeyboardMarkup, KeyboardButton

def make_row_keyboard(items: list[str]) -> ReplyKeyboardMarkup:

    row = [KeyboardButton(text=item) for item in items]
    return ReplyKeyboardMarkup(keyboard=[row], resize_keyboard=True)

def start_keyboard():
    kb = [
            [
                KeyboardButton(text="Add"),
                KeyboardButton(text='Manage'),
                KeyboardButton(text="Count"),
                KeyboardButton(text="Service")
            ],
        ]
    keyboard = ReplyKeyboardMarkup(
        keyboard=kb,
        resize_keyboard=True,
        input_field_placeholder="Choose action"
    )
    return (keyboard)

  1. Check the ParseMode Settings
    Make sure you’re setting the correct ParseMode. You’re already setting it to ParseMode.HTML in your main.py, but if there are any issues with the HTML tags in your message text, the bot will throw this error.

Check for missing or incorrect HTML tags in the message.answer() function. Even a single misplaced tag could cause this error.
For example, if you are using a string with unsupported HTML tags, that might be the problem. Verify that all HTML tags in your messages are correct and supported by Telegram.

New contributor

Rashmi Panchal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

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