Chat.update_chat() fails for private chats obtained from Bot.get_chat()
See original GitHub issueContext
- Operating System: Windows 10
- Python Version: 3.9.0
- aiogram version: 2.11.2
- aiohttp version: 3.7.3
- uvloop version (if installed): N/A
Expected Behavior
Chat is updated successfully.
Current Behavior
A TypeError is raised.
Failure Information (for bugs)
Steps to Reproduce
- Run the following code
import logging
from aiogram import Bot, Dispatcher, executor, types
logging.basicConfig(level=logging.INFO)
bot = Bot(token="TOKEN HERE")
dp = Dispatcher(bot)
@dp.message_handler(commands="test")
async def test(message: types.Message) -> None:
# No error if the following line is replaced with chat = message.chat
chat = await bot.get_chat(message.chat.id)
await chat.update_chat() # Error in this function call
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)
- Send
/testto the bot in its DMs or a private supergroup.
Failure Logs
Traceback (most recent call last):
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\dispatcher\dispatcher.py", line 388, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\dispatcher\dispatcher.py", line 225, in process_updates
return await asyncio.gather(*tasks)
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\dispatcher\dispatcher.py", line 246, in process_update
return await self.message_handlers.notify(update.message)
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\test\aiogramtest.py", line 14, in test
await chat.update_chat()
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\types\chat.py", line 123, in update_chat
self[key] = value
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\types\base.py", line 226, in __setitem__
return self.props[key].set_value(self, value, self.conf.get('parent', None))
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\types\fields.py", line 57, in set_value
value = self.deserialize(value, parent)
File "C:\Users\jono\AppData\Roaming\Python\Python39\site-packages\aiogram\types\fields.py", line 114, in deserialize
parent = weakref.ref(parent)
TypeError: cannot create weak reference to 'NoneType' object
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Telegram bot get chat informations python - Stack Overflow
because I get little information from getupdates I want to know some info like member IDs and messages IDs etc. in each group...
Read more >Failed to send in Microsoft Teams Private Chat
I have a question regarding failed to send messages in a Private Chat of Microsoft Teams. I tried to add Microsoft Forms to...
Read more >chat.update method - Slack API
This method updates a message in a channel. Though related to chat.postMessage , some parameters of chat.update are handled differently.
Read more >telegram.Chat - python-telegram-bot v20.0b0
If set, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in telegram.Bot.get_chat() . New in version...
Read more >tgbotapi - Go Packages
For private chats, this // update is received only when the bot is ... func (bot *BotAPI) GetChat(config ChatInfoConfig) (Chat, error).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

did dome investigation:
difference is in photo value that can`t be deserialize properly, as far as I understand
also here some detailed logs
Unfortunately, I canβt help you anymore due to lack of knowledge.
@JrooTJunior Should I look further for the cause of the bug? Or that can be the solution?