Skip to content

fix(email): handle missing @ in EMAIL_ADDRESS to prevent IndexError - #2772

Closed
dieutx wants to merge 1 commit into
NousResearch:mainfrom
dieutx:fix/email-address-split-crash
Closed

fix(email): handle missing @ in EMAIL_ADDRESS to prevent IndexError#2772
dieutx wants to merge 1 commit into
NousResearch:mainfrom
dieutx:fix/email-address-split-crash

Conversation

@dieutx

@dieutx dieutx commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Message-ID generation uses self._address.split('@')[1] at two locations (lines 441, 518)
  • Crashes with IndexError when EMAIL_ADDRESS env var is empty or malformed (no @ sign)
  • Fix: check for @ before splitting, fall back to hermes.local domain

How to reproduce

  • Set EMAIL_ADDRESS="" or EMAIL_ADDRESS="not-an-email" in .env
  • Send a message via the email gateway → IndexError crash

How to test

  • 3 new tests: normal address, malformed address, empty address
  • All 68 email tests pass

Platform tested

  • Linux, hermes-agent v0.4.0

The Message-ID generation uses self._address.split('@')[1] which
crashes with IndexError when EMAIL_ADDRESS env var is empty or
malformed (no @ sign). Fall back to 'hermes.local' domain.
@dieutx dieutx closed this Mar 24, 2026
@dieutx dieutx reopened this Mar 24, 2026
@dieutx dieutx closed this Mar 24, 2026
@dieutx dieutx reopened this Mar 24, 2026
@dieutx

dieutx commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing — niche edge case. #2794 takes a broader approach to email adapter hardening.

@dieutx dieutx closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant