pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

Infinity polling exception: ChatBoost.__init__() missing 3 required positional arguments

Open BrandonTay2001 opened this issue 1 year ago • 3 comments

Discussed in https://github.com/eternnoir/pyTelegramBotAPI/discussions/2174

Originally posted by BrandonTay2001 February 17, 2024 Receiving this exception on a bot I was running on a server and I'm not quite sure what to make of it. I run multiple bots but only one of them was affected by this bug. A simple restart seemed to have eliminated the issue, but I'm wondering if this is an issue with the .infinity_polling() method in the library. The issue doesn't seem to be originating from my bot file main.py.

Attaching the full exception below:

2024-02-17 12:11:42,006 (__init__.py:1021 MainThread) ERROR - TeleBot: "Infinity polling exception: ChatBoost.__init__() missing 3 required positional arguments: 'boost_id', 'add_date', and 'expiration_date'" 2024-02-17 12:11:42,006 (__init__.py:1023 MainThread) ERROR - TeleBot: "Exception traceback: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1016, in infinity_polling self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1104, in polling self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1179, in __threaded_polling raise e File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1140, in __threaded_polling polling_thread.raise_exceptions() File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 110, in raise_exceptions raise self.exception_info File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 92, in run task(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 661, in __retrieve_updates updates = self.get_updates(offset=(self.last_update_id + 1), File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 636, in get_updates return [types.Update.de_json(ju) for ju in json_updates] File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 636, in <listcomp> return [types.Update.de_json(ju) for ju in json_updates] File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 207, in de_json chat_boost = ChatBoost.de_json(obj.get('chat_boost')) File "/usr/local/lib/python3.10/dist-packages/telebot/types.py", line 9160, in de_json return cls(**obj) TypeError: ChatBoost.__init__() missing 3 required positional arguments: 'boost_id', 'add_date', and 'expiration_date'

Thanks :)

BrandonTay2001 avatar Feb 17 '24 12:02 BrandonTay2001

Install github version, maybe it will fix it

coder2020official avatar Feb 17 '24 12:02 coder2020official

What pyTelegramBotAPI version? Looks like not the most recent: update first.

Badiboy avatar Feb 17 '24 12:02 Badiboy

This is version 4.15.4. Updated pyTelegramBotAPI to the latest version though I don't know how the bug arose in the first place so I can't really try to recreate the issue. The exception was from my server logs and the bot was running without issue for multiple weeks.

So far so good on the latest version.

More information if needed: OS: Ubuntu 22.04 Python version: 3.10.12

BrandonTay2001 avatar Feb 18 '24 13:02 BrandonTay2001