different-ai/openwork · error · EmailSendError

resend_network

resend_network

Error message

[${input.template}] email for ${input.recipient} failed: ${input.reason}${input.detail ? ` (${input.detail})` : ""}

What it means

The Resend transport path wraps any exception that is not already an EmailSendError in EmailSendError with reason "resend_network". This signals a transport-level failure talking to Resend (DNS, TLS, timeout, connection reset) rather than an API-level rejection, with the underlying message preserved in detail.

Source

Thrown at packages/email/src/send-email.ts:150

      replyTo: input.replyTo,
      html: input.html,
      text: input.text,
    })

    if (result.error) {
      throw new EmailSendError({
        template: input.template,
        reason: "resend_rejected",
        recipient: input.to,
        detail: result.error.message,
      })
    }
  } catch (error) {
    if (error instanceof EmailSendError) {
      throw error
    }
    const message = error instanceof Error ? error.message : "Unknown error"
    throw new EmailSendError({ template: input.template, reason: "resend_network", recipient: input.to, detail: message })
  }
}

async function sendViaNodemailer(input: {
  to: string
  subject: string
  replyTo?: string
  html: string
  text: string
  template: EmailTemplate
  config: EmailSendConfig
}) {
  const from = input.config.from
  const smtp = input.config.smtp
  if (!from || !smtp?.host) {
    throw emailNotConfigured({
      template: input.template,
      recipient: input.to,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Check outbound connectivity to api.resend.com (DNS, firewall, proxy) from the environment running the send
  2. Retry the send — network failures are often transient; consider adding a retry with backoff around sendEmail
  3. If behind a corporate proxy, configure HTTPS_PROXY / NODE_EXTRA_CA_CERTS appropriately
  4. Check Resend's status page for ongoing incidents
  5. Inspect detail in the EmailSendError for the underlying message (e.g. getaddrinfo ENOTFOUND, certificate errors)

Example fix

// before
await sendEmail({ template: 'invite', to: addr }) // one-shot, fails on blips
// after
try {
  await sendEmail({ template: 'invite', to: addr })
} catch (e) {
  if (e instanceof EmailSendError && e.reason === 'resend_network') await retryWithBackoff(() => sendEmail({ template: 'invite', to: addr }))
  else throw e
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight connectivity check
const reachable = await fetch('https://api.resend.com', { method: 'HEAD' }).then(() => true).catch(() => false);
if (!reachable) console.warn('api.resend.com unreachable — sends will fail with resend_network');

Try / catch

try {
  await sendEmail({ template, to })
} catch (e) {
  if (e instanceof EmailSendError && e.reason === 'resend_network') {
    await retryWithBackoff(() => sendEmail({ template, to }), { attempts: 3 })
  } else throw e
}

Prevention

When it happens

Trigger: An exception thrown while awaiting the Resend SDK's emails.send call — fetch failure, timeout, socket hang-up, 5xx surfaced as a thrown network error — inside sendViaResend's try/catch.

Common situations: No outbound network access or DNS failure in the runtime environment; corporate proxy/firewall blocking api.resend.com; TLS interception certificates not trusted by Node; transient Resend outages; missing proxy configuration in containers/CI.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/adde06e6e1ddf7d6. Report an issue: GitHub.