Skip to content

fix: send error details to user in gateway outer exception handler#1966

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-6193ae92
Mar 18, 2026
Merged

fix: send error details to user in gateway outer exception handler#1966
teknium1 merged 1 commit intomainfrom
hermes/hermes-6193ae92

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

When an error occurs during response processing in _process_message_background (the outer try/except in gateway/platforms/base.py), the error was only logged to server console via print() + traceback.print_exc(). The user saw the typing indicator stop but received no message — radio silence.

This was reported by a Telegram user who kept getting silent failures with no way to diagnose what was wrong.

What changed

The outer except block in _process_message_background() now attempts to send the error type and detail (truncated to 300 chars) to the user's chat, matching the error format already used by the inner handler in gateway/run.py.

The send attempt is wrapped in its own try/except so if even error reporting fails, it won't crash the handler.

Why two layers?

  • Inner handler (gateway/run.py:2119): Catches agent/API errors during _handle_message() — already returns error details to user. Works well.
  • Outer handler (base.py:1098): Catches errors during response delivery (extract_media, send, image routing, etc.) or anything that escapes the inner handler. Previously silent. Now fixed.

Test plan

  • Gateway tests pass (1194 passed, 2 pre-existing failures in unrelated WhatsApp reply prefix tests)
  • No new dependencies or config changes
Previously, if an error occurred during response processing in
_process_message_background (e.g. during extract_media, send, or
any uncaught exception from the handler), the error was only logged
to server console and the user was left with radio silence — typing
indicator stops but no message arrives.

Now the outer except block attempts to send the error type and detail
(truncated to 300 chars) to the user's chat, matching the format
already used by the inner handler in gateway/run.py.
@teknium1 teknium1 merged commit 22f41da into main Mar 18, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant