Telegram Bot API · error code

Telegram error 400: Bad Request: can't parse InlineKeyboardButton: Text buttons are not allowed in the inline keyboard

ConfigurationHTTP 400400 Bad Request: identifiers, content and rights

Last verified against Telegram Bot API reference

What Telegram returns
Bad Request: can't parse InlineKeyboardButton: Text buttons are not allowed in the inline keyboard

What error 400 means

One of the buttons in your inline_keyboard has only a text label and no action field. The Bot API reference for InlineKeyboardButton says exactly one of the fields other than text, icon_custom_emoji_id and style must be used to specify the type of the button: callback_data, url, web_app, login_url, switch_inline_query, copy_text, pay and the others. A plain text button is valid in a reply keyboard but not in an inline one.

The prefix can't parse InlineKeyboardButton: comes from the server's array parser, which wraps the per-button error with the class name. The rest is the button-level reason. The whole request is rejected, so no message is sent.

The most common cause is an action field that was dropped silently: callback_data set to null or undefined and removed by the JSON serializer, or a url left empty because a config value was missing. A reply-keyboard row pasted into an inline keyboard produces the same message.

What it looks like

{"ok":false,"error_code":400,"description":"Bad Request: can't parse InlineKeyboardButton: Text buttons are not allowed in the inline keyboard"}

Why it happens

  • A button object has text only, with no callback_data, url or other action field.
  • callback_data was undefined or null and the serializer omitted it.
  • Rows built for a reply keyboard were reused under inline_keyboard.
  • A field name was misspelled (for example callbackData), so the server ignored it.

How to fix Telegram error 400

  1. 1Log the serialized reply_markup and find the button object that has only text.
  2. 2Give every inline button exactly one action field, typically callback_data (1-64 bytes) or url.
  3. 3Validate button data before serializing; reject empty or missing values instead of letting them disappear.
  4. 4Use snake_case field names exactly as documented.

How to stop it recurring

Build inline keyboards through a typed helper that refuses a button without an action. Unit-test the serialized JSON your keyboard code produces, not just the in-memory objects, because serializers drop empty fields silently. The keyboard builder shows valid button shapes, and keyboard limits covers callback_data size.

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?

One of the buttons in your inline_keyboard has only a text label and no action field. The Bot API reference for InlineKeyboardButton says exactly one of the fields other than text , icon_custom_emoji_id and style must be used to specify the type of the button: callback_data , url , web_app , login_url , switch_inline_query , copy_text , pay and the others.

How do I fix Telegram error 400?

1. Log the serialized reply_markup and find the button object that has only text . 2. Give every inline button exactly one action field, typically callback_data (1-64 bytes) or url . 3. Validate button data before serializing; reject empty or missing values instead of letting them disappear. 4. Use snake_case field names exactly as documented.

Stop debugging Telegram by hand

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