diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index e023d88b..a6bc06d2 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -309,6 +309,12 @@ class Session: if packet: error_code = -Int.read(BytesIO(packet)) + if error_code == 404: + raise Exception( + "Auth key not found in the system. You must delete your session file" + "and log in again with your phone number or bot token" + ) + log.warning( "Server sent transport error: %s (%s)", error_code, Session.TRANSPORT_ERRORS.get(error_code, "unknown error")