From Required
ERR-P01-MAIL-2002 - From Required
Section titled “ERR-P01-MAIL-2002 - From Required”Summary
Section titled “Summary”POST /mails could not resolve a From address for the outbound message.
When this is raised
Section titled “When this is raised”- The request omits
from, and the router has no default From address to fall back to (defaultFromAddris unset or empty), so the resolvedfrom.mailis missing. - In normal operation
apps/mailinjects a default of${accountId}@<MAIL_DOMAIN>, so this fires only when that default was not set - e.g. a misconfiguredMAIL_DOMAINor a caller path that bypasses the default-From middleware. - The body has already passed the
sendBodyschema (ERR-P01-MAIL-2001); this is the next check, specific to sender resolution.
What to do
Section titled “What to do”- Include an explicit
fromobject with a validmailfield in the request body. - If you expected the server to default the From address, report it to the
operator -
MAIL_DOMAINor the default-From middleware is likely misconfigured. - No message is sent when this fires; fix the From and resend.
Server-side cause
Section titled “Server-side cause”- Raised by:
packages/mail/src/router/index.ts- thePOST /mailshandler, after schema validation:if (!from?.mail) throw MAIL.fromRequired('from address is required'). - Guard:
fromisbody.fromfalling back to{ mail: defaultFromAddr }; when neither yields amail, the guard throws.
Example response
Section titled “Example response”{ "type": "https://citizenry.id/errors/ERR-P01-MAIL-2002", "title": "Bad Request", "status": 400, "code": "ERR-P01-MAIL-2002", "message": "from address is required", "method": "POST", "instance": "/mails", "request_url": "https://mail.citizenry.id/mails", "timestamp": "2026-05-17T07:00:00.000Z"}Related codes
Section titled “Related codes”ERR-P01-MAIL-2001- the body-shape validation that runs immediately before this From-resolution check.
Changelog
Section titled “Changelog”- 0.1.0 - introduced.