Telegram error 400: Bad Request: reply markup is too long
Last verified against Telegram Bot API reference
Bad Request: reply markup is too longWhat error 400 means
Telegram's servers rejected the keyboard attached to the message as too large. The underlying MTProto error is REPLY_MARKUP_TOO_LONG, documented for messages.sendMessage and messages.editMessage as "The specified reply_markup is too long." What you see is the Bot API server's lower-case rendering of that name.
Telegram does not publish a single byte ceiling for the whole markup in the Bot API reference, so do not rely on a number from a forum post. What is documented are per-field limits, such as callback_data being 1-64 bytes. A keyboard can respect every per-button limit and still be rejected in total when it has very many buttons, long labels, long URLs and long callback payloads at once.
Typical triggers are paginated lists rendered as one giant keyboard (every product or every user as a button), and callback_data stuffed with serialized state. The message text and chat are fine; only the markup size is the issue.
What it looks like
{"ok":false,"error_code":400,"description":"Bad Request: reply markup is too long"}Why it happens
- A list of dozens or hundreds of items rendered as one button per item.
- Long callback_data strings repeated on every button instead of a short key.
- Long URLs, often with tracking parameters, on many URL buttons.
- Keyboards that accumulate buttons across edits without removing old ones.
How to fix Telegram error 400
- 1Paginate: show a page of buttons plus Next and Previous controls.
- 2Replace verbose callback_data with a short identifier and keep state in your database.
- 3Shorten URLs or move them into the message text where appropriate.
- 4Rebuild the keyboard from scratch on each edit rather than appending.
- 5Remove buttons until the call succeeds to find the practical boundary for your layout.
How to stop it recurring
Design keyboards for a phone screen: a handful of rows with short labels is both readable and well inside server limits. Keep callback payloads to compact keys and look up the rest server-side. Documented per-field limits are on the keyboard limits page.
Official reference: Telegram Bot API reference. See all Telegram error codes or the Telegram limits and quotas.
Related codes
- 400: Bad Request: BUTTON_DATA_INVALIDBad Request: BUTTON_DATA_INVALID
- 400: Bad Request: can't parse InlineKeyboardButton: Text buttons are not allowed in the inline keyboardBad Request: can't parse InlineKeyboardButton: Text buttons are not allowed in…
- 400: Bad Request: message is too longBad Request: message is too long
Error 400 - quick answers
What does Telegram error 400 mean?
Telegram's servers rejected the keyboard attached to the message as too large. The underlying MTProto error is REPLY_MARKUP_TOO_LONG , documented for messages.sendMessage and messages.editMessage as "The specified reply_markup is too long." What you see is the Bot API server's lower-case rendering of that name.
How do I fix Telegram error 400?
1. Paginate: show a page of buttons plus Next and Previous controls. 2. Replace verbose callback_data with a short identifier and keep state in your database. 3. Shorten URLs or move them into the message text where appropriate. 4. Rebuild the keyboard from scratch on each edit rather than appending. 5. Remove buttons until the call succeeds to find the practical boundary for your layout.
Stop debugging Telegram by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.