#15168·onyx

IMAP connector crashes when indexing emails without a Message-ID header

Author: sergiotomaselloCreated Sep 27, 2026Updated Sep 27, 2026

Onyx version: 4.8.1

The IMAP connector fails the entire indexing job when it encounters an email message without a Message-ID header.

The traceback ends with:

pydantic_core._pydantic_core.ValidationError: 1 validation error for EmailHeaders id Input should be a valid string input_value=None

Relevant code path:

backend/onyx/connectors/imap/connector.py → EmailHeaders.from_email_msg(...) → EmailHeaders.id

I verified that the mailbox contains some valid messages without a Message-ID header.

Example IMAP query:

SEARCH NOT HEADER Message-ID ""

returns several messages.

Fetching one of those messages:

FETCH (BODY.PEEK[HEADER.FIELDS (MESSAGE-ID SUBJECT FROM DATE)])

returns headers such as:

Date: Subject: From:

with no Message-ID header present.

Expected behavior: The connector should not fail the entire indexing job when a message has no Message-ID.

Possible approaches:

  • skip the malformed/unsupported message and log a warning, or
  • generate a stable fallback identifier, preferably using mailbox + IMAP UID.

Using the IMAP sequence number alone would not be ideal because it may change between sessions.

Additional note: Mailbox selection and IMAP fetch work correctly. The failure occurs specifically while parsing headers for messages where Message-ID is missing.