aiogram.utils.exceptions.TerminatedByOtherGetUpdates: Terminated by other getupdates request; make sure that only one bot instance is running

aiogram.utils.exceptions.TerminatedByOtherGetUpdates: Terminated by other getupdates request; make sure that only one bot instance is running

I use Python 3.11.2, the latest version of Pycharm and Windows 10.

I’ve been bothered by this issue for days. I’ve seached and try the methods from the internet but it didn’t work. I don’t study Python before and I just want to build a simple telegram bot.

I’ve tried to revoke the bot token, use the task manager to stop the process, build another new bot, write the whole script again, uninstall and install again pycharm & python. But these didn’t work.

main.py

from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton

bot = Bot(token='__bot token__')
dp = Dispatcher(bot)

'#Main Menu'
button1 = KeyboardButton('Study Groups)
button2 = KeyboardButton('Important Subjects')
button3 = KeyboardButton('Sc Subjects')
button4 = KeyboardButton('Art Subjects')

'#Important Subjects Menu'
button5 = KeyboardButton('Notes ✍🏻')
button6 = KeyboardButton('Exercises ✍🏻')
button7 = KeyboardButton('Video ✍🏻')

'#Art Subjects Menu'
button8 = KeyboardButton('Notes 💴')
button9 = KeyboardButton('Exercises 💴')
button10 = KeyboardButton('Video 💴')

'#Sc Subjects Menu'
button11 = KeyboardButton('Notes 🧬')
button12 = KeyboardButton('Exercises 🧬')
button13 = KeyboardButton('Video 🧬')

'#Important Subjects Notes'
button14 = KeyboardButton('BM')
button15 = KeyboardButton('BI')
button16 = KeyboardButton('BC')
button17 = KeyboardButton('SEJ')
button18 = KeyboardButton('PM')
button19 = KeyboardButton('MATHS')

'#Art Subjects Notes'
button20 = KeyboardButton('SC')
button21 = KeyboardButton('ACC')
button22 = KeyboardButton('EKO')
button23 = KeyboardButton('Perniagaan')

'#Sc Subjects Notes'
button24 = KeyboardButton('BIO')
button25 = KeyboardButton('CHE')
button26 = KeyboardButton('PHY')
button27 = KeyboardButton('ADDMATHS')

'#Important Subjects Exercises'
button28 = KeyboardButton('BM')
button29 = KeyboardButton('BI')
button30 = KeyboardButton('BC')
button31 = KeyboardButton('SEJ')
button32 = KeyboardButton('PM')
button33 = KeyboardButton('MATHS')

'#Art Subjects Exercises'
button34 = KeyboardButton('SC')
button35 = KeyboardButton('ACC')
button36 = KeyboardButton('EKO')
button37 = KeyboardButton('Perniagaan')

'#Sc Subjects Exercises'
button38 = KeyboardButton('BIO')
button39 = KeyboardButton('CHE')
button40 = KeyboardButton('PHY')
button41 = KeyboardButton('ADDMATHS')

'#Important Subjects Video'
button42 = KeyboardButton('BM')
button43 = KeyboardButton('BI')
button44 = KeyboardButton('BC')
button45 = KeyboardButton('SEJ')
button46 = KeyboardButton('PM')
button47 = KeyboardButton('MATHS')

'#Art Subjects Video'
button48 = KeyboardButton('SC')
button49 = KeyboardButton('ACC')
button50 = KeyboardButton('EKO')
button51 = KeyboardButton('Perniagaan')

'#Sc Subjects Video'
button52 = KeyboardButton('BIO')
button53 = KeyboardButton('CHE')
button54 = KeyboardButton('PHY')
button55 = KeyboardButton('ADDMATHS')

'#Main Menu Study Groups'
keyboard1 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button1).add(button2).add(button3).add(button4)

'#Main Menu Subjects'
keyboard2 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button5).add(button6).add(button7)
keyboard3 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button8).add(button9).add(button10)
keyboard4 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button11).add(button12).add(button13)

'#Notes Subjects'
keyboard5 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button14).add(button15).add(button16).add(button17).add(button18).add(button19)
keyboard6 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button20).add(button21).add(button22).add(button23)
keyboard7 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button24).add(button25).add(button26).add(button27)

'#Exercises Subjects'
keyboard8 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button28).add(button29).add(button30).add(button31).add(button32).add(button33)
keyboard9 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button34).add(button35).add(button36).add(button37)
keyboard10 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button38).add(button39).add(button40).add(button41)

'#Video Subjects'
keyboard11 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button42).add(button43).add(button44).add(button45).add(button46).add(button47)
keyboard12 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button48).add(button49).add(button50).add(button51)
keyboard13 = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True).add(button52).add(button53).add(button54).add(button55)

@dp.message_handler(commands=['start'])
async def welcome(message: types.Message):
    await message.reply('Please choose: ', reply_markup=keyboard1)

@dp.message_handler()
async def kb_answer(message: types.Message):
    if message.text == 'Study Groups':
        await message.answer("Study Groups Links:\n I.Subjects : \n BM: \n https://t.me/+j6UlLBhcPLE3NmM9 \n BI: \n https://t.me/+pzpLKCbxUJZmZTY1 \n BC: \n https://t.me/+UF1YdarLaz9iMmFl \n MM: \n https://t.me/+jeT-Xpc3Kl8yMmM1 \n PM: \n https://t.me/+ywepqgUB8tJlMzk1 \n SEJ: \n https://t.me/+lt-prgM48qk2MGM1 \n \n Art Subjects: \n Acc : \n https://t.me/+B-HQPeHq5ik1NDk1 \n Eko : \n https://t.me/+m5hRLLiGSOdiMWNl \n Perniagaan : \n https://t.me/+X65z5D6iIeU4Yzdl \n Sc: \n https://t.me/+2vPbBO4EZNE0Y2E1 \n \n Sc Subjects: \n Fizik: \n https://t.me/+b50p16YkHTY4ZGY9 \n Kimia: \n https://t.me/+Cxq6au4BKDw0MGE1 \n Bio : \n https://t.me/+8BH-WBYeRf0yODc1 \n Add math: \n https://t.me/+NU843K2bc2I3MDhl")
    elif message.text == 'Important Subjects':
        await message.answer('Please choose:', reply_markup=keyboard2)
    elif message.text == 'Notes ✍🏻':
        await message.answer('Please choose:', reply_markup=keyboard5)
    elif message.text == 'Exercises ✍🏻':
        await message.answer('Please choose:', reply_markup=keyboard8)
    elif message.text == 'Video ✍🏻':
        await message.answer('Please choose:', reply_markup=keyboard11)
    elif message.text == 'Art Subjects':
        await message.answer('Please choose:', reply_markup=keyboard3)
    elif message.text == 'Notes 💴':
        await message.answer('Please choose:', reply_markup=keyboard6)
    elif message.text == 'Exercises 💴':
        await message.answer('Please choose:', reply_markup=keyboard9)
    elif message.text == 'Video 💴':
        await message.answer('Please choose:', reply_markup=keyboard12)
    elif message.text == 'Sc Subjects':
        await message.answer('Please choose:', reply_markup=keyboard4)
    elif message.text == 'Notes 🧬':
        await message.answer('Please choose:', reply_markup=keyboard7)
    elif message.text == 'Exercises 🧬':
        await message.answer('Please choose:', reply_markup=keyboard10)
    elif message.text == 'Video 🧬':
        await message.answer('Please choose:', reply_markup=keyboard13)
    else:
        await message.answer('Haven't update')

executor.start_polling(dp, skip_updates=True, on_startup=True, on_shutdown=True)

Requirements.txt

aiogram==2.25.1
aiohttp==3.8.4
aiosignal==1.3.1
async-timeout==4.0.2
attrs==22.2.0
Babel==2.11.0
certifi==2022.12.7
charset-normalizer==3.0.1
frozenlist==1.3.3
idna==3.4
multidict==6.0.4
pytz==2022.7.1
yarl==1.8.2
pip~=23.0.1
setuptools~=65.5.0
loguru~=0.6.0

Procfile

bot: python main.py

.gitignore

# Default ignored files
/shelf/
/workspace.xml
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

Hey there,

It looks like you might be attempting to run a bot on Render, there are a bunch of things that you probably need to know.

Bots are best deployed to us using a Background Worker - these run persistently in the background and don’t expose any web server however, these service types aren’t available with a free instance type.

If you try and run a bot via a Web Service, the deployment will probably fail, typically about 10 minutes after you’ve deployed it, and sometimes there are scenarios where 2 may be running for a period of time, this is down to our zero-downtime feature and not something that can be disabled.

We’ve been alerted to issues running Discord bots on us being rate limited by Discord, this is down to how traffic leaves our services - this may result in you receiving a 429 from Discord or having your requests rate limited - we’ve reached out to Discord but we don’t have a solution here yet.

If this doesn’t answer your question, just let us know, and we’ll try and help where we can

Regards,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.