diff --git a/telethon/client/updates.py b/telethon/client/updates.py index a8ad3a10..e4ac608b 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -319,6 +319,13 @@ class UpdateMethods: await self.disconnect() break continue + except errors.TypeNotFoundError as e: + # User is likely doing weird things with their account or session and Telegram gets confused as to what layer they use + self._log[__name__].warning('Cannot get difference since the account is likely misusing the session: %s', e) + self._message_box.end_difference() + self._updates_error = e + await self.disconnect() + break except OSError as e: # Network is likely down, but it's unclear for how long. # If disconnect is called this task will be cancelled along with the sleep. @@ -354,6 +361,19 @@ class UpdateMethods: await self.disconnect() break continue + except errors.TypeNotFoundError as e: + self._log[__name__].warning( + 'Cannot get difference since the account is likely misusing the session: %s', + get_diff.channel.channel_id, e + ) + self._message_box.end_channel_difference( + get_diff, + PrematureEndReason.TEMPORARY_SERVER_ISSUES, + self._mb_entity_cache + ) + self._updates_error = e + await self.disconnect() + break except ( errors.PersistentTimestampOutdatedError, errors.PersistentTimestampInvalidError,