Telegram error 409: Conflict: terminated by setWebhook request
Last verified against Telegram Bot API reference
Conflict: terminated by setWebhook requestWhat error 409 means
A getUpdates long-poll was waiting for updates when someone called setWebhook for the same bot. The Bot API server aborts the pending poll with this description, because the reference says you will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
It tells you two processes are driving the same token in different modes. The poller sees this once, and its next call will usually fail with can't use getUpdates method while webhook is active. If the poller's library then calls deleteWebhook to recover, the two processes fight: updates move back and forth, and both sides log errors.
The sibling message terminated by other getUpdates request is the polling-versus-polling version. This one specifically names setWebhook, so look for a webhook deployment, a hosting platform's integration, or a script that registered a webhook for the token your poller uses.
What it looks like
{"ok":false,"error_code":409,"description":"Conflict: terminated by setWebhook request"}Why it happens
- A production deployment uses a webhook while a developer runs the same token locally with polling.
- A hosting platform or third-party integration registered a webhook for the token.
- A startup script calls setWebhook in one service while another service polls.
- Blue-green deploys where the old version polls and the new one sets a webhook.
How to fix Telegram error 409
- 1Decide on one mode per token: webhook or polling, never both.
- 2Use a separate bot token from @BotFather for local development.
- 3Call
getWebhookInfoto see the registered URL and identify which service set it. - 4Remove the webhook with
deleteWebhookonly if polling is the intended mode, and stop the service that sets it.
How to stop it recurring
Keep one owner per bot token and document which deployment is responsible for setWebhook. Use different tokens for staging and production. The webhook checker shows the current registration, and pending update count explains what happens to queued updates when modes switch.
Official reference: Telegram Bot API reference. See all Telegram error codes or the Telegram limits and quotas.
Related codes
- 409: Conflict: can't use getUpdates method while webhook is activeConflict: can't use getUpdates method while webhook is active; use…
- 409: Conflict: terminated by other getUpdates requestConflict: terminated by other getUpdates request; make sure that only one bot…
- 400: Bad Request: invalid webhook URL specifiedBad Request: invalid webhook URL specified
Error 409 - quick answers
What does Telegram error 409 mean?
A getUpdates long-poll was waiting for updates when someone called setWebhook for the same bot. The Bot API server aborts the pending poll with this description, because the reference says you will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. It tells you two processes are driving the same token in different modes.
How do I fix Telegram error 409?
1. Decide on one mode per token: webhook or polling, never both. 2. Use a separate bot token from @BotFather for local development. 3. Call getWebhookInfo to see the registered URL and identify which service set it. 4. Remove the webhook with deleteWebhook only if polling is the intended mode, and stop the service that sets it.
Stop debugging Telegram by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.