hermes - 💡(How to fix) Fix Gateway crashes on Telegram Timeout - unhandled `telegram.error.TimedOut` exception

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

The Hermes gateway crashes when Telegram API requests time out. The telegram.error.TimedOut exception is not caught, causing the entire gateway process to die. Systemd restarts it after 5 seconds, but active conversation turns are interrupted. 3. Gateway crashes with unhandled telegram.error.TimedOut telegram.error.TimedOut: Timed out Full traceback ends in: Gateway should catch telegram.error.TimedOut, retry with backoff, and continue running. Timeout on a single message should not kill the entire gateway process. Wrap Telegram API calls in try/except telegram.error.TimedOut with retry logic in gateway/platforms/telegram.py, particularly around send_message and other network calls.

Code Example

telegram.error.TimedOut: Timed out

---

File "/home/pieter/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/request/_httpxrequest.py", line 296, in do_request
    raise TimedOut from err
RAW_BUFFERClick to expand / collapse

Bug Description

The Hermes gateway crashes when Telegram API requests time out. The telegram.error.TimedOut exception is not caught, causing the entire gateway process to die. Systemd restarts it after 5 seconds, but active conversation turns are interrupted.

Steps to Reproduce

  1. Have a Telegram bot connected to Hermes gateway
  2. Trigger a slow Telegram API response (or network latency)
  3. Gateway crashes with unhandled telegram.error.TimedOut

Observed Behavior

telegram.error.TimedOut: Timed out

Full traceback ends in:

File "/home/pieter/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/request/_httpxrequest.py", line 296, in do_request
    raise TimedOut from err

Gateway crashes, systemd restarts (11+ times observed), active conversation turns interrupted.

Expected Behavior

Gateway should catch telegram.error.TimedOut, retry with backoff, and continue running. Timeout on a single message should not kill the entire gateway process.

Environment

  • Hermes Agent: latest from main
  • Platform: Telegram (polling mode)
  • OS: Linux Mint (6.17.0-29-generic)
  • Python: 3.11
  • Profiles affected: All (Henry, Jake, Sven, Alfred)

Suggested Fix

Wrap Telegram API calls in try/except telegram.error.TimedOut with retry logic in gateway/platforms/telegram.py, particularly around send_message and other network calls.

Additional Context

  • Systemd service shows Restart=always and restart counter at 11+
  • Memory peak ~567-569MB (not OOM related)
  • All 4 agent profiles (Henry, Jake, Sven, Alfred) exhibit this behaviour

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 Gateway crashes on Telegram Timeout - unhandled `telegram.error.TimedOut` exception