Telegram Bot API · error code

Telegram error 400: Bad Request: user not found

Permanent - do not retryHTTP 400400 Bad Request: identifiers, content and rights

Last verified against Telegram Bot API reference

What Telegram returns
Bad Request: user not found

What error 400 means

A method that takes a user_id (for example getChatMember, restrictChatMember, promoteChatMember, sendGift or getUserProfilePhotos) was given an identifier Telegram cannot map to a user the bot is allowed to reference. It is the user-level twin of chat not found.

Bots can only reference users they have encountered: someone who messaged the bot, appeared in a group the bot is in, or was otherwise part of an update. Passing an arbitrary numeric ID you found elsewhere, or a phone number, does not work because the Bot API has no lookup by contact details.

The request itself is well-formed. The bot is authorized. The chat may even be correct. It is specifically the user reference that Telegram cannot resolve.

What it looks like

{"ok":false,"error_code":400,"description":"Bad Request: user not found"}

Why it happens

  • The user ID came from another bot, another system, or a scraped list and this bot has never seen that account.
  • A chat ID (negative) was passed in the user_id field, or the two were swapped in a function call.
  • The user deleted their account, so the ID no longer resolves.
  • The value was truncated by a 32-bit integer type; user IDs have exceeded 2^31 for years.

How to fix Telegram error 400

  1. 1Confirm the ID originates from an update this bot received (a from.id or new_chat_members[].id), not from an external source.
  2. 2Check the parameter order in your library call; swapping chat_id and user_id is the most common single cause.
  3. 3Run getChatMember with the same chat and user from a REST client to rule out serialization problems.
  4. 4If the account is deleted, remove the user from your records instead of retrying.

How to stop it recurring

Treat Telegram user IDs as opaque 64-bit values captured from updates, and never attempt to derive them. Validate at write time that user_id is positive and chat_id for groups is negative, which catches the swapped-argument bug before the API does. Build a deactivation path so that permanent lookups failures stop further calls for that account.

Client libraries surface this as a generic 400 (telegram.error.BadRequest in python-telegram-bot, TelegramBadRequest in aiogram), so match on the description string. If the same identifier also fails as a chat, compare against chat not found to work out which field is wrong. Bots built on a platform such as Conferbot's Telegram channel capture IDs from live updates, which avoids the imported-ID trap entirely.

Official reference: Telegram Bot API reference. See all Telegram error codes or the Telegram limits and quotas.

Related codes

Error 400 - quick answers

What does Telegram error 400 mean?

A method that takes a user_id (for example getChatMember , restrictChatMember , promoteChatMember , sendGift or getUserProfilePhotos ) was given an identifier Telegram cannot map to a user the bot is allowed to reference. It is the user-level twin of chat not found .

How do I fix Telegram error 400?

1. Confirm the ID originates from an update this bot received (a from.id or new_chat_members[].id ), not from an external source. 2. Check the parameter order in your library call; swapping chat_id and user_id is the most common single cause. 3. Run getChatMember with the same chat and user from a REST client to rule out serialization problems. 4. If the account is deleted, remove the user from your records instead of retrying.

Should I retry after error 400?

No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.

Stop debugging Telegram by hand

Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.