[Python] Error messages clogging Telethon resulting in security error: Server sent a very new...

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    I am really at a loss here, recently migrated to new machine and telethon has just broken down it seems. I've checked with others, so its probably just me, but I can't figure out how to solve this problem as it appears to be server side/telethon, but as it seems to be on my end it doesn't seem so obvious.

    Whenever launching telethon from an existing session I receive two error messages:


    Server sent a very new message with ID xxxxxxxxxxxxxxxxxxx, ignoring
    Server sent a very new message with ID xxxxxxxxxxxxxxxxxxx, ignoring
    ​

    And thereafter it gets clogged with the follow error messages, preventing any execution:


    [WARNING/2022-09-07] telethon.network.mtprotosender: Security error while unpacking a received message: Too many messages had to be ignored consecutively
    ​

    I've attached some standard code which reproduce this error for me. Could someone please give me a heads-up on whats causing this? And what to do about it? Running 3.10 Python and latest Telethon from pip.

    from telethon import TelegramClient, events
    from telethon.sessions import StringSession

    api_id = 1xxxxxxxxxx
    api_hash = '2xxxxxxxxxxxxx'
    ph = '+1xxxxxxxxxxxxxxxx'
    key = 'xxxxxx...'

    #client = TelegramClient('session', api_id, api_hash).start(phone = ph)
    client = TelegramClient(StringSession(key), api_id, api_hash).start(phone = ph)

    channelId = 'xxxxxxx'

    @client.on(events.NewMessage(chats = [channelId]))
    async def main(event):
    try:
    me = client.get_me()
    print(me.stringify())
    print(event.stringify())
    except Exception as e:
    print(e)


    client.run_until_disconnected()

    Continue reading...

Compartilhe esta Página