codex - 💡(How to fix) Fix Gmail connector rejects valid threaded reply with "Subject does not match"

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…

The Gmail connector can fail to send a threaded reply via _send_email with reply_message_id, returning Failed to build message payload / Subject does not match, even when the supplied subject appears to match the visible Gmail thread subject.

This looks like a connector-side subject validation or normalization issue rather than a Gmail authentication/problem, because Gmail search, thread read, and a non-threaded send all worked in the same session.

Error Message

GmailConnectorError: Failed to send email: {'error': 'Failed to build message payload', 'detail': 'Subject does not match'}

Root Cause

This looks like a connector-side subject validation or normalization issue rather than a Gmail authentication/problem, because Gmail search, thread read, and a non-threaded send all worked in the same session.

Fix Action

Fix / Workaround

The connector rejected the reply before send with Subject does not match, forcing a new unthreaded email as a workaround.

The workaround sends a separate email instead of replying inline, which can route to a different support representative and lose conversation continuity.

Code Example

GmailConnectorError: Failed to send email: {'error': 'Failed to build message payload', 'detail': 'Subject does not match'}
RAW_BUFFERClick to expand / collapse

Summary

The Gmail connector can fail to send a threaded reply via _send_email with reply_message_id, returning Failed to build message payload / Subject does not match, even when the supplied subject appears to match the visible Gmail thread subject.

This looks like a connector-side subject validation or normalization issue rather than a Gmail authentication/problem, because Gmail search, thread read, and a non-threaded send all worked in the same session.

What happened

  1. Searched Gmail for an existing conversation.
  2. Read the thread and selected the latest message ID as reply_message_id.
  3. Called _send_email with reply_message_id, recipient, body, and the visible reply subject.
  4. Connector failed before sending:
GmailConnectorError: Failed to send email: {'error': 'Failed to build message payload', 'detail': 'Subject does not match'}
  1. Retried with the visible non-Re: subject form from the existing sent message in the same conversation.
  2. Got the same Subject does not match error.
  3. Sent the same message body as a new email without reply_message_id; that succeeded immediately.

Expected behavior

When reply_message_id points at a valid Gmail message in a readable thread, _send_email should either:

  • accept normalized subject variants such as Re: <subject> vs <subject>, and common bracketed ticket prefixes, or
  • rely on Gmail reply headers/thread IDs instead of rejecting locally on a strict subject comparison.

Actual behavior

The connector rejected the reply before send with Subject does not match, forcing a new unthreaded email as a workaround.

User impact

The workaround sends a separate email instead of replying inline, which can route to a different support representative and lose conversation continuity.

Privacy note

All account names, email addresses, ticket IDs, subjects, and message contents from the original case have been intentionally omitted or generalized. The only included error text is the connector error itself.

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…

FAQ

Expected behavior

When reply_message_id points at a valid Gmail message in a readable thread, _send_email should either:

  • accept normalized subject variants such as Re: <subject> vs <subject>, and common bracketed ticket prefixes, or
  • rely on Gmail reply headers/thread IDs instead of rejecting locally on a strict subject comparison.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING