Skip to content

AttributeError: 'BadMsgNotification' object has no attribute 'type' #86

@vmatyushin

Description

@vmatyushin

I am using commit 838b4db78922b194101fbf78f1d54fc31e7fb03f.
API ID and hash were set using environment variables.
After entering the phone number the script fails with exception:

$ python3 cleaner.py
BadMsgNotification: [17] The msg_id is too high, the client time has to be synchronized.
BadMsgNotification: [17] The msg_id is too high, the client time has to be synchronized.
Welcome to Pyrogram (version 2.0.106)
Pyrogram is free software and comes with ABSOLUTELY NO WARRANTY. Licensed
under the terms of the GNU Lesser General Public License v3.0 (LGPL-3.0).

Enter phone number or bot token: +some_phone_number
Is "+some_phone_number" correct? (y/N): y
BadMsgNotification: [17] The msg_id is too high, the client time has to be synchronized.
Traceback (most recent call last):
  File "/home/user/telegram-delete-all-messages/cleaner.py", line 144, in <module>
    app.run(main())
    ~~~~~~~^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pyrogram/methods/utilities/run.py", line 77, in run
    run(coroutine)
    ~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/home/user/telegram-delete-all-messages/cleaner.py", line 138, in main
    await deleter.select_groups()
  File "/home/user/telegram-delete-all-messages/cleaner.py", line 63, in select_groups
    chats = await self.get_all_chats()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/telegram-delete-all-messages/cleaner.py", line 56, in get_all_chats
    async with app:
               ^^^
  File "/usr/lib/python3.13/site-packages/pyrogram/client.py", line 311, in __aenter__
    return await self.start()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pyrogram/methods/utilities/start.py", line 62, in start
    await self.authorize()
  File "/usr/lib/python3.13/site-packages/pyrogram/client.py", line 359, in authorize
    sent_code = await self.send_code(self.phone_number)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pyrogram/methods/auth/send_code.py", line 79, in send_code
    return types.SentCode._parse(r)
           ~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/site-packages/pyrogram/types/authorization/sent_code.py", line 58, in _parse
    type=enums.SentCodeType(type(sent_code.type)),
                                 ^^^^^^^^^^^^^^
AttributeError: 'BadMsgNotification' object has no attribute 'type'

Versions used:

$ pacman -Qi python python-tgcrypto python-pyrogram
Name            : python
Version         : 3.13.7-1
...
Name            : python-tgcrypto
Version         : 1.2.5-3
...
Name            : python-pyrogram
Version         : 2.0.106-2

I tried installing the dependencies using requirements.txt in venv.
I tried python 3.13, 3.12, 3.11, but the exception is the same.
I am doing something wrong?
It used to work long time ago.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions