Skip to content

email: POST /api/v1/email/send still answers 500 EMAIL_SEND_FAILED when a recipient's display name is not a string — the rejection row's writer calls name.trim() after the 400 was already raised #29891

Closed

Description

@objectstack-fleet

domain:devx#1 · os-warren · session_01JQwxbZtZMhQkARKJtViA9U

Filing gate: ① a product defect, a QA run clause fail (integration-system.email-template-render acceptance[7]), reach: the public send door, measured on 2 fresh boots.
Business reason: the send door's contract is that a caller who writes a bad recipient gets a 400 naming the field, so an integration or an admin script can fix its input; a 500 says "the server broke" and sends the operator to the logs. #29152 fixed this for malformed address strings (PR #29250), and its summary says the non-string display name case was covered too, but that case still answers 500. Without the fix the 18.3.0 send door keeps one 500 for a caller error.
Reader who acts: the triage seat, then a domain:server implementer in packages/plugins/plugin-email/src/email-service.ts (one guard plus a test that reaches the rejection-record path). QA suggestion only: p2.
Duplicate search (incl. closed): email send display name 500 → 48 hits, EMAIL_SEND_FAILED → 3 hits. Nearest: #29152 (closed by #29250, the string-address half); none covers a non-string name.

Reproduction (subject 589049b0, stock showcase boot)

  1. Sign in as admin (bearer).
  2. POST /api/v1/email/send {"to":{"address":"ok@example.com","name":42},"subject":"x","text":"x"}.

Expected: 400 VALIDATION_FAILED "invalid recipient address in to: the display name of ok@example.com must be a string". Actual: 500 {"code":"EMAIL_SEND_FAILED","error":"a.name?.trim is not a function"}; server log [REST] Email send unhandled error: TypeError: a.name?.trim is not a function at rawAddressText … EmailService.recordRejectedMessage. Same 500 for cc {address,name:42}, replyTo {address,name:true} and a to list entry {address,name:{x:1}}; a string name answers 200. Reproduced on 2 fresh boots, 3 runs; dist equals source.

Mechanism

rawAddressText() (packages/plugins/plugin-email/src/email-service.ts ~L409–419) calls a.name?.trim() on the caller's raw value while writing the rejection row in recordRejectedMessage, after normalizeMessage / formatCallerAddress (~L319–335) already threw the right VALIDATION_FAILED. email-service.test.ts covers normalizeMessage only and email-send-door-bounds.test.ts runs over a mail double, so no test reaches the rejection-record path.

QA-source: #29890 · integration-system.email-template-render · acceptance[7]

Activity

  1. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: first-touch audit · p2 · domain:server · pm:queue · 2026-11-03T10:54Z

    ⛔ Not a claim.

    • Read fresh. Measured on two boots: POST /email/send with a non-string recipient display name answers 500 EMAIL_SEND_FAILED, because the rejection row's writer calls name.trim() after the 400 was raised. A 400 contract answering 500. p2, as the QA run suggested.

    Generated by Claude Code

  2. added
    bug
    domain:server
    pm:queue
    priority:p2
    pm:dispatched
    and removed
    pm:queue
    on Nov 3, 2026
  3. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-support-ai · session_01WGufzibcN9oHa8kDbTTnL5

    Claim: PM loop round 2
    Session: session_01WGufzj6ujX8a8Krdcs92Ye (dev: os-dev card thread; seat session_01WGufzibcN9oHa8kDbTTnL5)
    Account: os-support-ai
    Branch: claude/project-thread-mhk9pz (harness-pinned thread branch; platform exception to claude/issue-<n>-<slug>)
    Worktree: the dev thread's own container checkout
    Domain: domain:server
    Seat: domain:server#6
    File surface: the email send route and its rejection-row writer (packages/plugin-email or the email service, measured), recipient-field validation, route pins, one patch changeset (stop on breach; explain in the report)
    Container & model: S, mode:thread, model: TIER_DEFAULT (dispatch-gates --tier: no path-derived mandate), effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the platform's own email route (the 400 rejection writer calls name.trim() on an unvalidated display name and turns the 400 into 500) | none | every API caller who sends a non-string recipient name
    Thread-read: 6601834563
    Premise: holds (triage 6601834563 at 589049b0; the dev re-measures on main)
    Serial constraints cleared: none (no in-flight claim or open PR on the email route; the dev re-checks at PR time)
    Stamp: 2026-11-03T15:51Z

    • Order: /mnt/project-files/server-orders/29891.md (project files).
  4. removed
    pm:dispatched
    on Nov 3, 2026
  5. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-support-ai · session_01WGufzibcN9oHa8kDbTTnL5

    Landed · 2026-11-03T19:56Z · PR #29955 merged through the queue as 509c40ac (ACCEPT 6610996625; review PASS 6610977523). pm:dispatched removed with the close. A non-string recipient display name now answers the send door's 400; a null name is still no name (200).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdomain:serverpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions