🤖
Hosting

Telegram bot "Conflict: terminated by other getUpdates" error: cause and fix

15.11.2026
← All articles

Sooner or later most Telegram bot developers see this line in their logs: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running. From then on the bot behaves erratically, replying to some messages and silently dropping others. The message itself names the cause: more than one program is asking Telegram for updates with the same token at the same time. This article explains where the second copy usually comes from, how to find it, and how to run the bot so it stays a single instance.

How the conflict happens

A bot receives updates in one of two ways. With getUpdates the bot keeps asking Telegram for new messages; with a webhook Telegram pushes each message to your URL. In getUpdates mode only one active request per token is allowed. When a second program sends the same request, Telegram cuts off the first one and answers it with a 409 Conflict. The two copies then keep kicking each other out, and which one receives the next message is random. If one copy runs older code, users see the new menu one moment and the old one the next.

Where the second copy hides

Picture a bot that takes orders for a flower shop in Tashkent. The developer tested it on a laptop, uploaded it to a server and started it there, but never closed the laptop terminal. Next morning the owner says half the orders are missing, because the laptop copy grabs part of the messages and stores them nowhere. Other common sources:

Finding the extra process

ps aux | grep -E "bot\.py|bot\.js" | grep -v grep
pgrep -af bot.py
pm2 list
systemctl status mybot.service

If more than one line shows up, keep the copy managed by systemd or PM2 and stop the rest by PID. Remove duplicate PM2 entries and save the list, otherwise both copies return after a reboot.

kill 12345
pm2 delete bot-old
pm2 save

Webhook and getUpdates at the same time

A related message is Conflict: can't use getUpdates method while webhook is active. Here the obstacle is an old webhook, for example from a time when the bot ran as a PHP script on a website before being rewritten in Python. Check and remove it with the Bot API:

curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo"
curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook"

If the url field in the response is empty, no webhook is set and the cause lies elsewhere. Pick one delivery method per bot and switch the other off completely.

Unknown copy: revoke the token

If no extra process exists on your machines but the error persists, the token is being used somewhere else: an old hosting account, an ex-teammate's computer or a config file pushed to a public repository. Run /revoke in @BotFather to invalidate the token and get a new one; every copy using the old token loses access immediately. Keep the new token in an environment variable or .env file that never goes into the repository.

Running exactly one instance

The cleanest setup is a systemd service, which restarts the bot after a crash and never starts a second copy.

# /etc/systemd/system/mybot.service
[Unit]
Description=Telegram order bot
After=network-online.target

[Service]
WorkingDirectory=/opt/mybot
ExecStart=/opt/mybot/venv/bin/python bot.py
Restart=always
RestartSec=5
EnvironmentFile=/opt/mybot/.env

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now mybot.service

If you must rely on cron, wrap the command in flock so a new run cannot start while the lock is held:

* * * * * flock -n /tmp/mybot.lock /opt/mybot/venv/bin/python /opt/mybot/bot.py

Shared hosting versus VPS

Shared hosting is built for websites, where a PHP script runs per request and exits. A permanently running bot process may be stopped by resource limits there, and a cron job that brings it back is exactly how duplicates multiply. A PHP bot fits shared hosting far better in webhook mode: Telegram calls the script, it replies and exits. A long-running Python or Node.js bot is more stable on a VPS with its own systemd service, which you can order from the sayt.uz cabinet.

Updating without spawning copies

Many conflicts start during an update. Stop the service, update the files, start it again, and use a separate test bot from @BotFather for experiments on your laptop so they never touch the live bot.

sudo systemctl stop mybot
cd /opt/mybot && git pull
sudo systemctl start mybot
journalctl -u mybot -n 50 --no-pager

If no Conflict lines appear in the log for a few minutes after the start, the bot is running as a single instance and the problem is solved.

Related articles

🔁 Migrating a WordPress Site: Replacing URLs Without Breaking Serialized Data 📊 Grafana and Prometheus: server monitoring basics 📬 Migrating Mailboxes with imapsync Without Losing a Single Email 🪶 Can you use SQLite in production?
🌐 Language
🇺🇿 O'zbek 🇺🇿 Ўзбек 🇷🇺 Русский 🇬🇧 English ✓