Skip to content

[Bug]: Telegram Send Failed: "Message thread not found" when sending to Groups with Topics enabled #22267

@moshtaghmaveddat

Description

@moshtaghmaveddat

Bug Description

Hermes gateway fails to send messages to Telegram groups that have Topics enabled, even when the bot is an Admin and the chat ID is valid. The send_message tool returns a Message thread not found error.

Steps to Reproduce

  1. Create a Telegram group and enable Topics.
  2. Add Hermes bot to the group and make it an Admin.
  3. Use the agent to send a message to the group via the send_message tool.

Expected Behavior

Hermes should be able to send messages to the default "General" topic, or allow the user to explicitly specify the Thread ID when targeting a chat.

Actual Behavior

The message fails to send with the following error:
Telegram send failed: Message thread not found

Note: Hermes can correctly list the Topics in the available targets (e.g., telegram:Group / topic 1), but fails to send the message despite the topic being visible.

Restart Required: Disabling Topics in the group settings does not immediately fix the issue. A full gateway restart (hermes gateway restart) and rejoining group is required to refresh the chat metadata.

  • Reply vs Send: The bot works perfectly when replying to a message (mention), but fails when trying to send a new message independently.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Telegram

Debug Report

📋 Report: https://paste.rs/8vSXD
📋 agent.log: https://paste.rs/U7BNq
📋 gateway.log: https://paste.rs/IWb5V

Operating System

Ubuntu 24

Python Version

No response

Hermes Version

0.13.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

Suggestion:

  1. Add logic to automatically use message_thread_id=1 (General Topic) when sending to a group with Topics enabled.
  2. Improve the documentation on how to correctly format targets for specific Threads/Topics in send_message.
  3. Handle stale chat metadata more gracefully without requiring a full gateway restart.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions