telethon.errors package

telethon.errors.common module

Errors not related to the Telegram API itself

exception telethon.errors.common.BrokenAuthKeyError

Bases: Exception

Occurs when the authorization key for a data center is not valid.

exception telethon.errors.common.CdnFileTamperedError

Bases: telethon.errors.common.SecurityError

Occurs when there’s a hash mismatch between the decrypted CDN file and its expected hash.

exception telethon.errors.common.InvalidChecksumError(checksum, valid_checksum)

Bases: Exception

Occurs when using the TCP full mode and the checksum of a received packet doesn’t match the expected checksum.

exception telethon.errors.common.ReadCancelledError

Bases: Exception

Occurs when a read operation was cancelled.

exception telethon.errors.common.SecurityError(*args)

Bases: Exception

Generic security error, mostly used when generating a new AuthKey.

exception telethon.errors.common.TypeNotFoundError(invalid_constructor_id)

Bases: Exception

Occurs when a type is not found, for example, when trying to read a TLObject with an invalid constructor code.

telethon.errors.rpc_base_errors module

exception telethon.errors.rpc_base_errors.AuthKeyError(message)

Bases: telethon.errors.rpc_base_errors.RPCError

Errors related to invalid authorization key, like AUTH_KEY_DUPLICATED which can cause the connection to fail.

code = 406
message = 'AUTH_KEY'
exception telethon.errors.rpc_base_errors.BadMessageError(code)

Bases: Exception

Occurs when handling a bad_message_notification.

ErrorMessages = {16: 'msg_id too low (most likely, client time is wrong it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the "correct" msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted).', 17: 'msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id).', 18: 'Incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4).', 19: 'Container msg_id is the same as msg_id of a previously received message (this must never happen).', 20: 'Message too old, and it cannot be verified whether the server has received a message with this msg_id or not.', 33: 'msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno).', 35: 'Odd msg_seqno expected (relevant message), but even received.', 32: 'msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno).', 64: 'Invalid container.', 48: 'Incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it).', 34: 'An even msg_seqno expected (irrelevant message), but odd received.'}
exception telethon.errors.rpc_base_errors.BadRequestError

Bases: telethon.errors.rpc_base_errors.RPCError

The query contains errors. In the event that a request was created using a form and contains user generated data, the user should be notified that the data must be corrected before the query is repeated.

code = 400
message = 'BAD_REQUEST'
exception telethon.errors.rpc_base_errors.FloodError

Bases: telethon.errors.rpc_base_errors.RPCError

The maximum allowed number of attempts to invoke the given method with the given input parameters has been exceeded. For example, in an attempt to request a large number of text messages (SMS) for the same phone number.

code = 420
message = 'FLOOD'
exception telethon.errors.rpc_base_errors.ForbiddenError(message)

Bases: telethon.errors.rpc_base_errors.RPCError

Privacy violation. For example, an attempt to write a message to someone who has blacklisted the current user.

code = 403
message = 'FORBIDDEN'
exception telethon.errors.rpc_base_errors.InvalidDCError

Bases: telethon.errors.rpc_base_errors.RPCError

The request must be repeated, but directed to a different data center.

code = 303
message = 'ERROR_SEE_OTHER'
exception telethon.errors.rpc_base_errors.NotFoundError(message)

Bases: telethon.errors.rpc_base_errors.RPCError

An attempt to invoke a non-existent object, such as a method.

code = 404
message = 'NOT_FOUND'
exception telethon.errors.rpc_base_errors.RPCError

Bases: Exception

Base class for all Remote Procedure Call errors.

code = None
message = None
exception telethon.errors.rpc_base_errors.ServerError(message)

Bases: telethon.errors.rpc_base_errors.RPCError

An internal server error occurred while a request was being processed for example, there was a disruption while accessing a database or file storage.

code = 500
message = 'INTERNAL'
exception telethon.errors.rpc_base_errors.UnauthorizedError

Bases: telethon.errors.rpc_base_errors.RPCError

There was an unauthorized attempt to use functionality available only to authorized users.

code = 401
message = 'UNAUTHORIZED'