hermes - 💡(How to fix) Fix [Bug]: send_message does not recognize explicit email targets and incorrectly falls back to home target resolution [1 pull requests]

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

Because the parsed result is not treated as explicit, the routing logic falls back to the email home target path and eventually throws an error. Email targets fall through the parser, forcing the system into home target resolution, which fails with the following error: 7. If no home target is configured, the operation fails with a home-target-related error. 7. If no home target is configured, the operation fails with a home-target-related error. For example, a contact name may resolve to a valid email address, but Hermes still falls back to home target resolution instead of sending directly. If no home target is configured, the operation fails with a home-target-related error.

Additional Logs / Traceback (optional)

Root Cause

Because the parsed result is not treated as explicit, the routing logic falls back to the email home target path and eventually throws an error.

Fix Action

Fixed

Code Example

Hermes Agent v0.15.1 (2026.5.29)

Reproduced with proactive email sending via send_message(...).
A direct email target such as email:someone@example.com is not treated as explicit and falls back to home target resolution.

Observed:
- _parse_target_ref('email', '[email protected]') -> (None, None, False)
- email gateway IMAP/SMTP otherwise appeared functional
- inbound/reply flow seemed okay; issue appears specific to proactive send path

---
RAW_BUFFERClick to expand / collapse

Bug Description

🐛 Bug Report: send_message_tool.py misses explicit target parsing for email platform

Describe the bug

When using send_message with the email platform, a valid email address is not recognized as an explicit target.

As a result, send_message incorrectly falls back to the email home target resolution instead of sending directly to the resolved address. This causes proactive email sends to fail even when the target has already been resolved to a valid email address.

Note: Inbound email handling and reply flows appear to work normally, so this issue is specific to the proactive send_message(...) path.


Environment / Observed On

  • Hermes Agent Version: v0.15.1 (2026.05.29)

Reproduction Steps & Example Behavior

  1. Alias Resolution (Works): resolve_channel_name('email', 'ChouWeiping') -> returns '[email protected]'
  2. Target Parsing (Fails): _parse_target_ref('email', '[email protected]') -> returns (None, None, False)

Because the parsed result is not treated as explicit, the routing logic falls back to the email home target path and eventually throws an error.

Affected Scenarios:

  • Using Alias: send_message(target="email:ChouWeiping", message="test") (Fails even though the name resolves to a valid email address.)

  • Using Direct Email Target: send_message(target="email:[email protected]", message="test") (Also fails because the raw email address isn't recognized as explicit.)


Expected Behavior

A valid email target should be treated as explicit and routed directly, without requiring an email home target to be configured.

For example, after resolution: _parse_target_ref('email', '[email protected]') Should return an explicit target result (is_explicit=True) rather than (None, None, False).

Actual Behavior

Email targets fall through the parser, forcing the system into home target resolution, which fails with the following error: No home channel set for email to determine where to send the message...


Suspected Root Cause

In tools/send_message_tool.py, the _parse_target_ref(...) method implements platform-specific explicit-target parsing for several platforms (e.g., Slack, Discord, Telegram), but completely lacks an email branch.

Because of this gap, valid email addresses fall through the parser and default to (None, None, False).


Suggested Fix

Treat valid email addresses as explicit targets in _parse_target_ref(...) by adding an email branch:

elif platform == "email": if "@" in target_ref: return target_ref, None, True

(The final validation logic may want to be stricter than this, but the primary issue is that explicit email targets currently are not parsed at all.)


Additional Note

There also seems to be a naming inconsistency around the fallback/home-target path between:

  • EMAIL_HOME_CHANNEL
  • EMAIL_HOME_ADDRESS

While this may be a separate issue, it appears secondary here. The primary bug is that explicit email targets are not recognized, which incorrectly forces the fallback path in the first place.

Steps to Reproduce

Steps to Reproduce

  1. Configure Hermes email gateway with working IMAP/SMTP credentials.
  2. Ensure an email contact exists in the channel directory, or use a previously learned contact from an inbound email session.
  3. Confirm the contact name resolves to an email address, e.g.: resolve_channel_name('email', 'ContactName') -> returns '[email protected]'
  4. Trigger a proactive message using either an alias or a direct email target:
    • send_message(target="email:ContactName", message="test")
    • send_message(target="email:[email protected]", message="test")
  5. Observe that the resolved email target is not recognized as explicit.
  6. Hermes falls back to the email home target path instead of sending directly to the explicit address.
  7. If no home target is configured, the operation fails with a home-target-related error.

Expected Behavior

Steps to Reproduce

  1. Configure Hermes email gateway with working IMAP/SMTP credentials.
  2. Ensure an email contact exists in the channel directory, or use a previously learned contact from an inbound email session.
  3. Confirm the contact name resolves to an email address, e.g.: resolve_channel_name('email', 'ContactName') -> returns '[email protected]'
  4. Trigger a proactive message using either an alias or a direct email target:
    • send_message(target="email:ContactName", message="test")
    • send_message(target="email:[email protected]", message="test")
  5. Observe that the resolved email target is not recognized as explicit.
  6. Hermes falls back to the email home target path instead of sending directly to the explicit address.
  7. If no home target is configured, the operation fails with a home-target-related error.

Actual Behavior

A resolved email target is not recognized as explicit by the proactive send_message path.
For example, a contact name may resolve to a valid email address, but Hermes still falls back to home target resolution instead of sending directly. If no home target is configured, the operation fails with a home-target-related error.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

Hermes Agent v0.15.1 (2026.5.29)

Reproduced with proactive email sending via send_message(...).
A direct email target such as email:[email protected] is not treated as explicit and falls back to home target resolution.

Observed:
- _parse_target_ref('email', '[email protected]') -> (None, None, False)
- email gateway IMAP/SMTP otherwise appeared functional
- inbound/reply flow seemed okay; issue appears specific to proactive send path

Operating System

Ubuntu 24.04 (Linux 7.0.3-1-t2-noble)

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

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 [Bug]: send_message does not recognize explicit email targets and incorrectly falls back to home target resolution [1 pull requests]