Forums

Always-on tasks error

I have deployed my Telegram bot on this service, and it works correctly. However, after setting up an (Always-on tasks) to ensure that the bot restarts automatically in case of server reboots, I am encountering errors, and the bot starts to behave incorrectly. How can I resolve this issue? (My English is not very good, so I apologize.)

2024-08-20 09:55:37,366 - httpx - INFO - HTTP Request: POST https://api.telegram.org/bot MY TOKEN /getUpdates "HTTP/1.1 409 Conflict"
2024-08-20 09:55:37,367 - telegram.ext.Updater - ERROR - Error while getting Updates: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2024-08-20 09:55:37,367 - telegram.ext.Application - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/ext/_updater.py", line 755, in _network_loop_retry
    if not await do_action():
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/ext/_updater.py", line 749, in do_action
    return action_cb_task.result()
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/ext/_updater.py", line 389, in polling_action_cb
    raise exc
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/ext/_updater.py", line 378, in polling_action_cb
    updates = await self.bot.get_updates(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/ext/_extbot.py", line 649, in get_updates
    updates = await super().get_updates(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/_bot.py", line 4364, in get_updates
    await self._post(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/_bot.py", line 622, in _post
    return await self._do_post(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/ext/_extbot.py", line 355, in _do_post
    return await super()._do_post(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/_bot.py", line 651, in _do_post
    result = await request.post(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/request/_baserequest.py", line 200, in post
    result = await self._request_wrapper(
  File "/home/den1s/.local/lib/python3.10/site-packages/telegram/request/_baserequest.py", line 383, in _request_wrapper
    raise Conflict(message)
telegram.error.Conflict: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running

[edit by admin: formatting]

Do you have another copy of your bot running, perhaps in a console or a scheduled task? That error is saying that there are two copies running.

No, I don't have any other versions running. Maybe I'm doing something wrong. I uploaded the files and started the application through the console using python bot.py. It worked, and in tasks, I set up the same task python3 /home/den1s/ArtLikes3DHub/bot.py Or do I need to write a separate script that will handle the auto-start and specify the path to it? Sorry for the silly questions.

Do you see the script listed in a table when you click on "Fetch processes" button on the consoles page? If so, that means you had the script running in the console and in the task.