aiogram Bot Instance Conflict Error: Multiple getUpdates Requests Issue

I keep getting this annoying error when my Telegram bot tries to handle user messages. The error says there are multiple bot instances running but I made sure to close all other processes. I even tried creating a new bot token and API key but the same problem keeps happening.

The error message looks like this:

ERROR:aiogram.dispatcher:Failed to fetch updates - TelegramConflictError: Telegram server says - Conflict: terminated by other getUpdates request; make sure that only one bot instance is running

Here’s my bot code:

import asyncio
from aiogram import Bot, Dispatcher
from aiogram.utils.exceptions import TerminatedByOtherGetUpdates

API_TOKEN = '...'

async def handle_conflict_error(update, exception):
    print('Bot conflict detected, shutting down...')

telegram_bot = Bot(token=API_TOKEN)
dispatcher = Dispatcher(telegram_bot)
dispatcher.register_errors_handler(callback=handle_conflict_error,
                                  exception=TerminatedByOtherGetUpdates)

async def run_bot():
    await dispatcher.start_polling()

if __name__ == '__main__':
    asyncio.run(run_bot())

Does anyone know what might be causing this conflict? I really need help fixing this issue.

This sounds like a bot session termination issue. Ctrl+C doesn’t always properly close the connection to Telegram’s servers. I fixed this by adding cleanup code with await bot.close() and await dp.storage.close() before the script ends. Also, if you’re using PyCharm or similar IDEs, the console sometimes doesn’t fully kill processes when you stop execution. Try adding signal handlers for graceful shutdowns when interrupted. Oh, and check if you’ve got any cron jobs or scheduled tasks automatically starting your bot without you realizing it.

This happens when you’ve got zombie processes running or multiple instances of your bot without realizing it. Check your task manager for any leftover python processes running your bot code. If you’re using Heroku or Railway, make sure scaling is set to exactly 1 dyno. Another culprit - running the bot locally while it’s also deployed somewhere else. Telegram only allows one active getUpdates request per bot token at a time, so they’ll conflict. Try restarting your system completely, then run just one instance to see if that fixes it.

had this prob too! try await bot.delete_webhook() b4 starting polling. old webhooks can interfere with getUpdates. and check if ur platform auto-restarts ur app, that caused me issues too.