-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
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
- Configure a Telegram bot channel with a valid bot token
- Invalidate the token (e.g., via gateway restart with a config issue, or token rotation)
- Observe the gateway log — it will spam sendChatAction requests every ~1 second indefinitely
- 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