Skip to content

[Bug]: Telegram gateway sends unbounded sendChatAction requests on 401, causing Telegram to delete bots #27092

@reemyazigi-vibecoding

Description

@reemyazigi-vibecoding

Summary

When a Telegram bot token becomes invalid (401 Unauthorized), the gateway enters an infinite loop of sendChatAction API calls with no exponential backoff. This results in thousands of rapid-fire 401 errors (~1 request per second, nonstop), which causes Telegram to flag the bot as abusive and permanently delete it.

Steps to reproduce

  1. Configure a Telegram bot channel with a valid bot token
  2. Invalidate the token (e.g., via gateway restart with a config issue, or token rotation)
  3. Observe the gateway log — it will spam sendChatAction requests every ~1 second indefinitely
  4. After several hours of this, Telegram deletes the bot entirely

Expected behavior

  • The gateway should implement exponential backoff on 401 errors
  • After N consecutive 401 failures, the Telegram channel should be suspended (not retried indefinitely)
  • An alert/log entry should clearly indicate the bot token is invalid and needs replacement
  • The gateway should NOT continue hammering the Telegram API with a known-bad token

Actual behavior

  • Gateway sends sendChatAction every ~1 second with no backoff
  • In a single day's log, we observed 15,899 sendChatAction failures and 16,788 total 401 errors out of 18,594 log lines (~85% error rate)
  • Telegram interprets this as bot abuse and deletes the bot
  • This has happened to us twice in 48 hours — two separate bots destroyed by the same behavior

OpenClaw version

2026.2.24 (also reproduced on 2026.2.22-2 and 2026.2.23)

Operating system

macOS 26.2 (arm64)

Install method

pnpm (global)

Logs, screenshots, and evidence

# ~40 consecutive errors in 40 seconds (representative sample):
telegram sendChatAction failed: Call to 'sendChatAction' failed! (401: Unauthorized)  01:54:43
telegram sendChatAction failed: Call to 'sendChatAction' failed! (401: Unauthorized)  01:54:44
telegram sendChatAction failed: Call to 'sendChatAction' failed! (401: Unauthorized)  01:54:46
telegram sendChatAction failed: Call to 'sendChatAction' failed! (401: Unauthorized)  01:54:47
... (continues every 1-2 seconds for hours)

Impact and severity

Critical — this bug destroys Telegram bots permanently
Users must create new bots via @Botfather each time
All existing chat history with users is lost
Users who had the old bot must find and start a conversation with the new one

Additional information

Suggested Fix:
Implement exponential backoff on 401 responses (e.g., 1s -> 2s -> 4s -> 8s -> ... -> max 5min)
After 10 consecutive 401 errors, suspend the channel and log a clear warning
Require manual intervention (openclaw channels restart telegram or config update) to resume
Consider rate-limiting all Telegram API calls to stay well within Telegram's abuse thresholds

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions