Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Effect KitEmails

Errors

Every error the Emails package can fail with, its tag, fields and when it occurs.

All errors are tagged classes, so _tag equals the class name. email.send fails with EmailError, Email.sendMany with BatchError, EmailReact.render with RenderError, and layer construction with a configuration error.

EmailError

The only expected error of email.send. Its message is Email submission: <reason tag>.

FieldTypeDescription
providerstringProvider name of the service that failed.
operation"send"The only operation.
acceptance"notSubmitted" | "rejected" | "unknown"What is known about submission.
reasonEmailErrorReasonOne of the reasons below.
statusCodenumber (optional)HTTP status, 100 to 599.
providerCodestring (optional)A provider code from a reviewed list. Other codes are dropped.
referencesSubmissionReference[] (optional)Provider identifiers, when the failure carries any.

Handle a reason with Effect.catchReason("EmailError", "<ReasonTag>", handler).

acceptance

ValueSet when
notSubmittedDecoding fails (InvalidMessageError), a capability check fails (UnsupportedFeatureError), or an adapter pre-flight check fails.
rejectedThe default for an HTTP 4xx status other than 409.
unknownThe default for everything else: 409, 5xx, timeouts, transport errors, an unreadable response. Also set when the core rejects a receipt.

Adapters can override the default for a specific failure. A repeated Resend key, for example, reports unknown even though the status is 4xx.

Reasons

ReasonExtra fieldsDefault status mapping
InvalidMessageErrorpaths400, 422
UnsupportedFeatureErrorfeaturenone
AuthenticationErrornone401
PermissionDeniedErrornone403
RateLimitedErrorretryAfter?429
QuotaExceededErrorretryAfter?none
RecipientRejectedErrorrecipientsnone
MessageRejectedErrornonenone
IdempotencyConflictErrornonenone
TransportErrornonenone
TimeoutErrornonenone
ProviderUnavailableErrorretryAfter?5xx
UnexpectedResponseErrornonenone
ProviderErrornoneany other status

The mapping column is the default applied when an adapter gives only a status. Adapters map provider-specific codes to more precise reasons.

  • paths is an array of field paths. Each segment is a field name, an integer index, or "*" for an unknown key.
  • retryAfter is a Duration, a hint only.
  • recipients is an array of { role: "to" | "cc" | "bcc", index: number }.
  • feature is an EmailFeature.

EmailFeature

text, html, htmlAndText, senderName, cc, bcc, replyTo, multipleReplyTo, headers, attachments, inlineAttachments, idempotency. The order in which they are checked is in Capabilities.

BatchError

Fails Email.sendMany before any send. It has one field, reason.

reasonMeaning
InvalidRequestsrequests is not an array or has more than 1,000 entries.
InvalidOptionsBatchOptions is invalid, such as a concurrency outside 1 to 1000.

Failures of individual messages are not a BatchError. They are returned as results.

RenderError

Fails render from @effect-kit/emails/react. It has one field, reason. An exception thrown by your component is a defect, not a RenderError.

reasonMeaning
InvalidElementThe first argument is not a React element.
InvalidOptionsThe options are invalid.
InvalidContentThe rendered HTML or text is blank.

Configuration errors

Layer construction (layer, layerClient, layerConfig) fails with a configuration error when an option is invalid. layerConfig can also fail with Config.ConfigError when an environment variable is missing or malformed.

ErrorProvidersfield values
ResendConfigurationErrorresendapiKey, baseUrl, timeout
NodemailerConfigurationErrornodemailertransport, timeout, retries
SesConfigurationErrorsesregion, timeout, endpoint, configurationSetName
AzureConfigurationErrorazureconnectionString, timeout, pollInterval
ProviderConfigurationErrorThe other twelvefield is a string. The error also carries provider.

Each class is exported from its provider subpath.