Skip to content
Puranode

Guide

Telegram Bot 409 Conflict Error: How to Fix It

A Telegram bot gets 409 Conflict, with the message Conflict: terminated by other getUpdates request; make sure that only one bot instance is running, when two processes are asking Telegram for the same token's updates at once. Telegram delivers updates either to one getUpdates long poll or to one webhook, never to both and never to two pollers. The fix is to find the other copy and stop it: usually a forgotten instance on your own computer, an old deployment, or a webhook something else keeps setting.

Published

On this page

FAQ

Frequently asked

What does Conflict: terminated by other getUpdates request mean?

Two processes are long polling the same bot token. Telegram serves one getUpdates request per bot at a time, so each new request ends the other one, and the loser receives HTTP 409. Stop every copy of the bot except one.

Can I run the same Telegram bot on two servers?

Not with long polling on the same token. Telegram delivers updates to one getUpdates poller or one webhook. For a second environment, such as testing, create another bot with BotFather and give it its own token.

Does a webhook cause a 409 for a polling bot?

It stops polling: the Bot API says getUpdates does not work while an outgoing webhook is set. Check with getWebhookInfo and remove it with deleteWebhook. python-telegram-bot and grammY delete a webhook when polling starts, so one that reappears is being set by another deployment.

I stopped everything and still get 409. What now?

Some copy you cannot reach is still polling, such as an old host or a leaked token. Send /token to BotFather to generate a new token, put it only in the environment of the bot you want to keep, and restart it.

Should my Telegram bot use polling or a webhook?

Long polling suits most bots: it is outbound only and needs no public address or certificate. A webhook needs a public HTTPS URL on port 443, 80, 88 or 8443. Use one or the other, since Telegram treats them as mutually exclusive.

How much does bot hosting cost at Puranode?

Hobby is €4.99 every 30 days for one bot on 0.5 vCPU and 512 MB of RAM, with auto-restart on crash. Standard is €9.99 for up to three bots on 1 vCPU and 1 GB. Prices include VAT.

Projects referenced

This guide names other people’s work. These are their own pages, so you get the current documentation rather than our summary of it.

  • Telegram Bot API: The two mutually exclusive ways of receiving updates, getUpdates and its note that it does not work while a webhook is set, deleteWebhook, getWebhookInfo, logOut, and the request format with GET and POST.
  • Telegram bot features: BotFather: The /newbot and /token commands, testing on a separate bot, and the warning that a token can be used by anyone to control the bot.
  • python-telegram-bot: telegram.error: The Conflict exception, raised when a long poll or webhook conflicts with another one.
  • python-telegram-bot: The source that maps HTTP 409 to Conflict and calls delete_webhook before polling starts.
  • grammY: deployment types: Long polling compared with webhooks, and the rule never to call bot.start() when using webhooks.
  • grammY: The source of bot.start(), which deletes the webhook before polling and rethrows 401 and 409 errors instead of retrying them.
  • aiogram: TelegramConflictError, described in the source as the token already being used by another application in polling mode.

Run one copy, all day, somewhere else

Hobby runs one bot on 0.5 vCPU and 512 MB, with auto-restart on crash, for €4.99 every 30 days. Standard runs up to three bots on 1 GB for €9.99. VAT included.