Telegram Bot API · error code

Telegram error 400: Bad Request: TOPIC_CLOSED

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

Last verified against Telegram Bot API reference

What Telegram returns
Bad Request: TOPIC_CLOSED

What error 400 means

The bot tried to post into a forum topic that has been closed. TOPIC_CLOSED is an MTProto error name; Telegram's method documentation for messages.sendMessage describes it as "This topic was closed, you can't send messages to it anymore." The Bot API server passes upper-case server errors through unchanged after the Bad Request: prefix, which is why it looks different from the sentence-style descriptions.

Closing a topic is reversible: the topic and its history still exist, it just stops accepting new messages. Admins with the right permissions can reopen it, and so can a bot that has can_manage_topics or created the topic itself, according to the closeForumTopic and reopenForumTopic docs.

So this is not a bad ID; a deleted or invalid topic gives message thread not found instead. It is also not a membership problem: the bot is in the chat. It is the topic's state that blocks the send, and it will keep failing until the topic is reopened.

What it looks like

{"ok":false,"error_code":400,"description":"Bad Request: TOPIC_CLOSED"}

Why it happens

  • An admin closed the topic the bot posts into, often after a discussion ended.
  • A scheduled job posts into a fixed topic ID without checking its state.
  • The bot closed the topic itself in an earlier step and then tried to reply.

How to fix Telegram error 400

  1. 1Reopen the topic with reopenForumTopic if the bot has can_manage_topics or created it.
  2. 2Otherwise route the message to the General topic or another open topic.
  3. 3Listen for forum_topic_closed and forum_topic_reopened service messages and track state per topic.
  4. 4Catch the error string and stop retrying that topic until it is reopened.

How to stop it recurring

Maintain a per-topic open or closed flag driven by the service messages Telegram already sends, and consult it before posting. When a closed topic is part of a workflow, give the bot can_manage_topics so it can reopen deliberately, or agree with admins on an always-open topic for bot output.

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?

The bot tried to post into a forum topic that has been closed. TOPIC_CLOSED is an MTProto error name; Telegram's method documentation for messages.sendMessage describes it as "This topic was closed, you can't send messages to it anymore." The Bot API server passes upper-case server errors through unchanged after the Bad Request: prefix, which is why it looks different from the sentence-style descriptions.

How do I fix Telegram error 400?

1. Reopen the topic with reopenForumTopic if the bot has can_manage_topics or created it. 2. Otherwise route the message to the General topic or another open topic. 3. Listen for forum_topic_closed and forum_topic_reopened service messages and track state per topic. 4. Catch the error string and stop retrying that topic until it is reopened.

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.