hermes - 💡(How to fix) Fix Telegram TimedOut exceptions crash entire gateway (affects all profiles)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Unhandled telegram.error.TimedOut exceptions crash the entire Hermes gateway process, affecting all agent profiles (default/Henry, jake, sven, alfred). 3. telegram.error.TimedOut is raised 4. Exception is unhandled → gateway process dies telegram.error.TimedOut: Timed out

  • Gateway dies immediately on unhandled exception
  1. Catch telegram.error.TimedOut except telegram.error.TimedOut:

Fix Action

Workaround

Currently none — all profiles affected, systemd restarts gateway after 5s but active conversation is lost.

Code Example

telegram.error.TimedOut: Timed out
...
hermes-gateway.service: Scheduled restart job, restart counter is at 11

---

try:
    msg = await self._bot.send_message(...)
except telegram.error.TimedOut:
    logger.warning("Telegram API timeout, retrying...")
    # Implement retry with backoff
    # Don't crash the gateway
RAW_BUFFERClick to expand / collapse

Bug Description

Unhandled telegram.error.TimedOut exceptions crash the entire Hermes gateway process, affecting all agent profiles (default/Henry, jake, sven, alfred).

Steps to Reproduce

  1. Telegram API experiences slow response (network latency, API degradation)
  2. Gateway attempts to send a message via Telegram
  3. telegram.error.TimedOut is raised
  4. Exception is unhandled → gateway process dies
  5. systemd restarts gateway after 5 seconds (Restart=always)

Evidence from Logs

telegram.error.TimedOut: Timed out
...
hermes-gateway.service: Scheduled restart job, restart counter is at 11

From journalctl --user -u hermes-gateway:

  • Crash trace shows telegram/request/_httpxrequest.py raising TimedOut
  • Gateway dies immediately on unhandled exception
  • All profiles affected (jake logs show multiple Timeout crashes)

Impact

  • All profiles crash: Henry, Jake, Sven, Alfred all experience gateway restarts
  • Conversation interruption: Active turns are killed mid-response (confirmed 4+ times in one session)
  • User experience: Messages appear to send but responses are lost
  • Restart loop: Restart=always + unhandled exceptions = crash/restart cycle

Environment

  • OS: Linux Mint (6.17.0-29-generic)
  • Hermes Agent: latest main
  • Telegram bot: polling mode
  • systemd service with Restart=always

Expected Behavior

Gateway should:

  1. Catch telegram.error.TimedOut
  2. Implement retry/backoff logic
  3. Log warning but not crash
  4. Maintain conversation state across temporary API issues

Suggested Fix

In gateway/platforms/telegram.py, wrap message sends in try/except:

try:
    msg = await self._bot.send_message(...)
except telegram.error.TimedOut:
    logger.warning("Telegram API timeout, retrying...")
    # Implement retry with backoff
    # Don't crash the gateway

Workaround

Currently none — all profiles affected, systemd restarts gateway after 5s but active conversation is lost.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Telegram TimedOut exceptions crash entire gateway (affects all profiles)