diff --git a/readthedocs/quick-references/faq.rst b/readthedocs/quick-references/faq.rst index 22133cbb..adf56727 100644 --- a/readthedocs/quick-references/faq.rst +++ b/readthedocs/quick-references/faq.rst @@ -197,6 +197,32 @@ the most common patterns seem to be: multiple places, login and use a different session for each place you need. +What does "Server replied with a wrong session ID" mean? +======================================================== + +This is a security feature from Telethon that cannot be disabled and is +meant to protect you against unwanted session reuse. + +When this message is reported as a "bug", the most common patterns seem to be: + +* The proxy you're using may be interfering somehow. +* The Telethon session is being used or has been used from somewhere else. + Make sure that you created the session from Telethon, and are not using the + same session anywhere else. If you need to use the same account from + multiple places, login and use a different session for each place you need. +* You may be using multiple connections to the Telegram server, which seems + to confuse Telegram. + +Most of the time it should be safe to ignore this warning. If the library +still doesn't behave correctly, make sure to check if any of the above bullet +points applies in your case and try to work around it. + +If the issue persists and there is a way to reliably reproduce this error, +please add a comment with any additional details you can provide to +`issue 3759`_, and perhaps some additional investigation can be done +(but it's unlikely, as Telegram *is* sending unexpected data). + + What does "Could not find a matching Constructor ID for the TLObject" mean? =========================================================================== @@ -305,4 +331,5 @@ file and run that, or use the normal ``python`` interpreter. .. _logging: https://docs.python.org/3/library/logging.html .. _@SpamBot: https://t.me/SpamBot .. _issue 297: https://github.com/LonamiWebs/Telethon/issues/297 +.. _issue 3759: https://github.com/LonamiWebs/Telethon/issues/3759 .. _quart_login.py: https://github.com/LonamiWebs/Telethon/tree/v1/telethon_examples#quart_loginpy diff --git a/telethon/network/mtprotostate.py b/telethon/network/mtprotostate.py index bba9ab3c..53b66306 100644 --- a/telethon/network/mtprotostate.py +++ b/telethon/network/mtprotostate.py @@ -176,7 +176,7 @@ class MTProtoState: reader = BinaryReader(body) reader.read_long() # remote_salt if reader.read_long() != self.id: - raise SecurityError('Server replied with a wrong session ID') + raise SecurityError('Server replied with a wrong session ID (see FAQ for details)') remote_msg_id = reader.read_long()