RPC Errors

All Pyrogram API errors live inside the errors sub-package: pyrogram.errors. The errors ids listed here are shown as UPPER_SNAKE_CASE, but the actual exception names to import from Pyrogram follow the usual PascalCase convention.

from pyrogram.errors import FloodWait

try:
    ...
except FloodWait as e:
    ...

303 - SeeOther

id

message

FILE_MIGRATE_X

The file to be accessed is currently stored in DC{x}

PHONE_MIGRATE_X

The phone number a user is trying to use for authorization is associated with DC{x}

NETWORK_MIGRATE_X

The source IP address is associated with DC{x} (for registration)

USER_MIGRATE_X

The user whose identity is being used to execute queries is associated with DC{x} (for registration)

400 - BadRequest

id

message

FIRSTNAME_INVALID

The first name is invalid

LASTNAME_INVALID

The last name is invalid

PHONE_NUMBER_INVALID

The phone number is invalid

PHONE_CODE_HASH_EMPTY

phone_code_hash is missing

PHONE_CODE_EMPTY

phone_code is missing

PHONE_CODE_EXPIRED

The confirmation code has expired

PHONE_CODE_INVALID

The confirmation code is invalid

API_ID_INVALID

The api_id/api_hash combination is invalid

PHONE_NUMBER_OCCUPIED

The phone number is already in use

PHONE_NUMBER_UNOCCUPIED

The phone number is not yet being used

USERS_TOO_FEW

Not enough users (to create a chat, for example)

USERS_TOO_MUCH

The maximum number of users has been exceeded (to create a chat, for example)

TYPE_CONSTRUCTOR_INVALID

The type constructor is invalid

FILE_PART_INVALID

The file part number is invalid. The value is not between 0 and 2999

FILE_PARTS_INVALID

Invalid number of parts. The value is not between 1 and 3000

FILE_PART_X_MISSING

Part {x} of the file is missing from storage

MD5_CHECKSUM_INVALID

The file’s checksum did not match the md5_checksum parameter

PHOTO_INVALID_DIMENSIONS

The photo dimensions are invalid

FIELD_NAME_INVALID

The field with the name FIELD_NAME is invalid

FIELD_NAME_EMPTY

The field with the name FIELD_NAME is missing

MSG_WAIT_FAILED

A waiting call returned an error

PEER_ID_INVALID

The id/access_hash combination is invalid

MESSAGE_EMPTY

The message sent is empty

ENCRYPTED_MESSAGE_INVALID

The special binding message (bind_auth_key_inner) contains invalid data

INPUT_METHOD_INVALID

The method called is invalid

PASSWORD_HASH_INVALID

Two-step verification password is invalid

USERNAME_NOT_OCCUPIED

The username is not occupied by anyone

USERNAME_INVALID

The username is invalid

MESSAGE_ID_INVALID

The message id is invalid

MESSAGE_NOT_MODIFIED

The message was not modified

ENTITY_MENTION_USER_INVALID

The mentioned entity is not an user

MESSAGE_TOO_LONG

The message text is over 4096 characters

ACCESS_TOKEN_EXPIRED

The bot token is invalid

BOT_METHOD_INVALID

The method can’t be used by bots

QUERY_TOO_SHORT

The query is too short

SEARCH_QUERY_EMPTY

The query is empty

CHAT_ID_INVALID

The chat id is invalid

DATE_EMPTY

The date argument is empty

PERSISTENT_TIMESTAMP_EMPTY

The pts is empty

CDN_METHOD_INVALID

The method can’t be used on CDN DCs

VOLUME_LOC_NOT_FOUND

The volume location can’t be found

FILE_ID_INVALID

The file id is invalid

LOCATION_INVALID

The file address is invalid

CHAT_ADMIN_REQUIRED

The method requires chat admin privileges

PHONE_NUMBER_BANNED

The phone number is banned

ABOUT_TOO_LONG

The about text is too long

MULTI_MEDIA_TOO_LONG

The album contains more than 10 items

USERNAME_OCCUPIED

The username is already in use

BOT_INLINE_DISABLED

The inline feature of the bot is disabled

INLINE_RESULT_EXPIRED

The inline bot query expired

INVITE_HASH_INVALID

The invite link hash is invalid

USER_ALREADY_PARTICIPANT

The user is already a participant of this chat

TTL_MEDIA_INVALID

The media does not support self-destruction

MAX_ID_INVALID

The max_id parameter is invalid

CHANNEL_INVALID

The channel parameter is invalid

DC_ID_INVALID

The dc_id parameter is invalid

LIMIT_INVALID

The limit parameter is invalid

OFFSET_INVALID

The offset parameter is invalid

EMAIL_INVALID

The email provided is invalid

USER_IS_BOT

A bot cannot send messages to other bots or to itself

WEBPAGE_CURL_FAILED

Telegram server could not fetch the provided URL

STICKERSET_INVALID

The requested sticker set is invalid

PEER_FLOOD

The method can’t be used because your account is limited

MEDIA_CAPTION_TOO_LONG

The media caption is longer than 1024 characters

USER_NOT_MUTUAL_CONTACT

The user is not a mutual contact

USER_CHANNELS_TOO_MUCH

The user is already in too many channels or supergroups

API_ID_PUBLISHED_FLOOD

You are using an API key that is limited on the server side

USER_NOT_PARTICIPANT

The user is not a member of this chat

CHANNEL_PRIVATE

The channel/supergroup is not accessible

MESSAGE_IDS_EMPTY

The requested message doesn’t exist

WEBPAGE_MEDIA_EMPTY

The URL doesn’t contain any valid media

QUERY_ID_INVALID

The callback query id is invalid

MEDIA_EMPTY

The media is invalid

USER_IS_BLOCKED

The user blocked you

YOU_BLOCKED_USER

You blocked this user

ADMINS_TOO_MUCH

The chat has too many administrators

BOTS_TOO_MUCH

The chat has too many bots

USER_ADMIN_INVALID

The action requires admin privileges

INPUT_USER_DEACTIVATED

The target user has been deactivated

PASSWORD_RECOVERY_NA

The password recovery e-mail is not available

PASSWORD_EMPTY

The password entered is empty

PHONE_NUMBER_FLOOD

This number has tried to login too many times

TAKEOUT_INVALID

The takeout id is invalid

TAKEOUT_REQUIRED

The method must be invoked inside a takeout session

MESSAGE_POLL_CLOSED

You can’t interact with a closed poll

MEDIA_INVALID

The media is invalid

BOT_SCORE_NOT_MODIFIED

The bot score was not modified

USER_BOT_REQUIRED

The method can be used by bots only

IMAGE_PROCESS_FAILED

The server failed to process your image

USERNAME_NOT_MODIFIED

The username was not modified

CALL_ALREADY_ACCEPTED

The call is already accepted

CALL_ALREADY_DECLINED

The call is already declined

PHOTO_EXT_INVALID

The photo extension is invalid

EXTERNAL_URL_INVALID

The external media URL is invalid

CHAT_NOT_MODIFIED

The chat settings were not modified

RESULTS_TOO_MUCH

The result contains too many items

RESULT_ID_DUPLICATE

The result contains items with duplicated identifiers

ACCESS_TOKEN_INVALID

The bot access token is invalid

INVITE_HASH_EXPIRED

The chat invite link is no longer valid

USER_BANNED_IN_CHANNEL

You are limited, check @SpamBot for details

MESSAGE_EDIT_TIME_EXPIRED

You can no longer edit this message

FOLDER_ID_INVALID

The folder id is invalid

MEGAGROUP_PREHISTORY_HIDDEN

The action failed because the supergroup has the pre-history hidden

CHAT_LINK_EXISTS

The action failed because the supergroup is linked to a channel

LINK_NOT_MODIFIED

The chat link was not modified because you tried to link to the same target

BROADCAST_ID_INVALID

The channel is invalid

MEGAGROUP_ID_INVALID

The supergroup is invalid

BUTTON_DATA_INVALID

The button callback data contains invalid data or exceeds 64 bytes

START_PARAM_INVALID

The start parameter is invalid

ARTICLE_TITLE_EMPTY

The article title is empty

FILE_PART_TOO_BIG

The size limit (512 KB) for the content of the file part has been exceeded

FILE_PART_EMPTY

The file part sent is empty

FILE_PART_SIZE_INVALID

512 KB cannot be evenly divided by part_size

FILE_PART_SIZE_CHANGED

The part size is different from the size of one of the previous parts in the same file

FILE_MIGRATE_X

The file is in Data Center No. {x}

401 - Unauthorized

id

message

AUTH_KEY_UNREGISTERED

The key is not registered in the system

AUTH_KEY_INVALID

The key is invalid

USER_DEACTIVATED

The user has been deleted/deactivated

USER_DEACTIVATED_BAN

The user has been deleted/deactivated

SESSION_REVOKED

The authorization has been invalidated, because of the user terminating all sessions

SESSION_EXPIRED

The authorization has expired

ACTIVE_USER_REQUIRED

The method is only available to already activated users

AUTH_KEY_PERM_EMPTY

The method is unavailable for temporary authorization key, not bound to permanent

SESSION_PASSWORD_NEEDED

Two-step verification password required

403 - Forbidden

id

message

CHAT_WRITE_FORBIDDEN

You don’t have rights to send messages in this chat

RIGHT_FORBIDDEN

One or more admin rights can’t be applied to this kind of chat (channel/supergroup)

CHAT_ADMIN_INVITE_REQUIRED

You don’t have rights to invite other users

MESSAGE_DELETE_FORBIDDEN

You don’t have rights to delete messages in this chat

CHAT_SEND_MEDIA_FORBIDDEN

You can’t send media messages in this chat

MESSAGE_AUTHOR_REQUIRED

You are not the author of this message

406 - NotAcceptable

id

message

AUTH_KEY_DUPLICATED

Authorization error - you must delete your session file and log in again with your phone number

FILEREF_UPGRADE_NEEDED

The file reference has expired - you must obtain the original media message

420 - Flood

id

message

FLOOD_WAIT_X

A wait of {x} seconds is required

TAKEOUT_INIT_DELAY_X

You have to confirm the data export request using one of your mobile devices or wait {x} seconds

500 - InternalServerError

id

message

AUTH_RESTART

User authorization has restarted

RPC_CALL_FAIL

Telegram is having internal problems. Please try again later

RPC_MCGET_FAIL

Telegram is having internal problems. Please try again later

PERSISTENT_TIMESTAMP_OUTDATED

Telegram is having internal problems. Please try again later

HISTORY_GET_FAILED

Telegram is having internal problems. Please try again later

REG_ID_GENERATE_FAILED

Telegram is having internal problems. Please try again later

RANDOM_ID_DUPLICATE

Telegram is having internal problems. Please try again later

WORKER_BUSY_TOO_LONG_RETRY

Telegram is having internal problems. Please try again later

INTERDC_X_CALL_ERROR

Telegram is having internal problems at DC{x}. Please try again later

INTERDC_X_CALL_RICH_ERROR

Telegram is having internal problems at DC{x}. Please try again later

FOLDER_DEAC_AUTOFIX_ALL

Telegram is having internal problems. Please try again later

MSGID_DECREASE_RETRY

Telegram is having internal problems. Please try again later