From 3e64ea35ff623b33fed12900c7695b6762868681 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 6 Apr 2023 12:38:25 +0200 Subject: [PATCH] Update FAQ --- readthedocs/quick-references/faq.rst | 37 ++++++++++++++++++++++++++++ telethon/errors/common.py | 4 +-- telethon/network/mtprotostate.py | 4 +-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/readthedocs/quick-references/faq.rst b/readthedocs/quick-references/faq.rst index 7b649303..22133cbb 100644 --- a/readthedocs/quick-references/faq.rst +++ b/readthedocs/quick-references/faq.rst @@ -178,6 +178,43 @@ won't do unnecessary work unless you need to: sender = await event.get_sender() +What does "Server sent a very new message with ID" mean? +======================================================== + +You may also see this error as "Server sent a very old message with ID". + +This is a security feature from Telethon that cannot be disabled and is +meant to protect you against replay attacks. + +When this message is incorrectly reported as a "bug", +the most common patterns seem to be: + +* Your system time is incorrect. +* 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. + + +What does "Could not find a matching Constructor ID for the TLObject" mean? +=========================================================================== + +Telegram uses "layers", which you can think of as "versions" of the API they +offer. When Telethon reads responses that the Telegram servers send, these +need to be deserialized (into what Telethon calls "TLObjects"). + +Every Telethon version understands a single Telegram layer. When Telethon +connects to Telegram, both agree on the layer to use. If the layers don't +match, Telegram may send certain objects which Telethon no longer understands. + +When this message is reported as a "bug", the most common patterns seem to be +that he 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. + + What does "bases ChatGetter" mean? ================================== diff --git a/telethon/errors/common.py b/telethon/errors/common.py index 4f2573d6..86bdf827 100644 --- a/telethon/errors/common.py +++ b/telethon/errors/common.py @@ -19,8 +19,8 @@ class TypeNotFoundError(Exception): def __init__(self, invalid_constructor_id, remaining): super().__init__( 'Could not find a matching Constructor ID for the TLObject ' - 'that was supposed to be read with ID {:08x}. Most likely, ' - 'a TLObject was trying to be read when it should not be read. ' + 'that was supposed to be read with ID {:08x}. See the FAQ ' + 'for more details. ' 'Remaining bytes: {!r}'.format(invalid_constructor_id, remaining)) self.invalid_constructor_id = invalid_constructor_id diff --git a/telethon/network/mtprotostate.py b/telethon/network/mtprotostate.py index 03026706..bba9ab3c 100644 --- a/telethon/network/mtprotostate.py +++ b/telethon/network/mtprotostate.py @@ -208,12 +208,12 @@ class MTProtoState: time_delta = now - remote_msg_time if time_delta > MSG_TOO_OLD_DELTA: - self._log.warning('Server sent a very old message with ID %d, ignoring', remote_msg_id) + self._log.warning('Server sent a very old message with ID %d, ignoring (see FAQ for details)', remote_msg_id) self._count_ignored() return None if -time_delta > MSG_TOO_NEW_DELTA: - self._log.warning('Server sent a very new message with ID %d, ignoring', remote_msg_id) + self._log.warning('Server sent a very new message with ID %d, ignoring (see FAQ for details)', remote_msg_id) self._count_ignored() return None