Budibase/budibase · error · HTTPError

Automation trigger is not an email trigger

Error message

Automation trigger is not an email trigger

What it means

The automation has a trigger, but it is not an email trigger type. hydrateEmailConnectionPassword only applies to IMAP/email triggers, since only they store a password in their inputs; any other trigger type is rejected with HTTP 400.

Source

Thrown at packages/server/src/api/controllers/automation.ts:252

    throw new HTTPError(
      "Automation ID is required to test a saved password",
      400
    )
  }

  const automation = await context
    .getWorkspaceDB()
    .tryGet<Automation>(automationId)
  if (!automation) {
    throw new HTTPError("Automation not found", 404)
  }

  const trigger = automation.definition.trigger
  if (!trigger) {
    throw new HTTPError("No trigger found for automation", 400)
  }
  if (!isEmailTrigger(trigger)) {
    throw new HTTPError("Automation trigger is not an email trigger", 400)
  }
  if (!trigger.inputs.password) {
    throw new HTTPError("IMAP password is required", 400)
  }

  const stored = trigger.inputs
  const connectionMatches =
    emailInputs.host === stored.host &&
    emailInputs.port === stored.port &&
    emailInputs.username === stored.username &&
    emailInputs.secure === stored.secure
  if (!connectionMatches) {
    throw new HTTPError(
      "IMAP password is required when connection details change",
      400
    )
  }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Pass the automationId of an automation with an email (IMAP) trigger
  2. Change the automation's trigger to an email trigger if that was intended
  3. Provide the plaintext password directly instead of relying on the saved trigger
Defensive patterns

Strategy: type-guard

Validate before calling

if (automation.definition?.trigger && !automation.definition.trigger.event?.includes('EMAIL')) {
  throw new Error('testEmailConnection requires an email-trigger automation')
}

Type guard

function isEmailTrigger(t: unknown): t is EmailTrigger {
  return typeof t === 'object' && t !== null && 'inputs' in t && typeof (t as { inputs: unknown }).inputs === 'object'
}

Try / catch

try {
  await testEmailConnection({ emailInputs, automationId })
} catch (e) {
  if (e.status === 400 && e.message.includes('not an email trigger')) {
    // select an automation with an email trigger
  }
}

Prevention

When it happens

Trigger: Calling testEmailConnection with an automationId whose trigger is e.g. a row-created, webhook, or schedule trigger instead of an email trigger.

Common situations: Passing the wrong automationId (pointing at a non-email automation); UI state referencing an automation whose trigger type was changed after load.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/ff5ba63660df2450. Report an issue: GitHub.