{"record":{"id":"e4c7c4b46dfe4238","repo":"Budibase/budibase","slug":"email-trigger-inputs-are-required","errorCode":null,"errorMessage":"Email trigger inputs are required","messagePattern":"Email trigger inputs are required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/automations/email/index.ts","lineNumber":33,"sourceCode":"  const mailbox = imapInputs.mailbox || DEFAULT_MAILBOX\n\n  try {\n    imapClient = await getClient(imapInputs)\n    await imapClient.connect()\n    await imapClient.mailboxOpen(mailbox)\n  } finally {\n    if (imapClient) {\n      await imapClient.logout().catch(console.warn)\n    }\n  }\n}\n\nexport const checkMail = async (\n  automationId: string,\n  imapInputs: EmailTriggerInputs\n): Promise<CheckMailOutput> => {\n  if (!imapInputs) {\n    throw new Error(\"Email trigger inputs are required\")\n  }\n\n  let imapClient: Awaited<ReturnType<typeof getClient>> | null = null\n  const mailbox = imapInputs.mailbox || DEFAULT_MAILBOX\n  const stateKey = automationId\n\n  try {\n    imapClient = await getClient(imapInputs)\n    const lastSeenUid = await getLastSeenUid(stateKey, mailbox)\n    const messages = await fetchMessages(imapClient, mailbox, lastSeenUid)\n    console.info(\n      `[email trigger] fetched ${messages.length} messages from mailbox ${mailbox}`\n    )\n\n    if (!messages.length) {\n      return { proceed: false, reason: \"no new mail\" }\n    }\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/automations/email/index.ts#L15-L51","documentation":"checkMail drives the IMAP email trigger polling. It requires the trigger's imapInputs (server, port, credentials, mailbox etc.); if the inputs object is falsy, an Error is thrown before any IMAP connection is attempted.","triggerScenarios":"An email trigger automation is executed with no inputs configured — e.g. the trigger definition lacks the IMAP configuration block, or inputs were lost/not passed during a manual trigger or import.","commonSituations":"Importing an app where the email trigger inputs were not exported; creating the trigger without completing IMAP setup (host/port/auth); older app versions with a different input shape.","solutions":["Edit the email trigger in the automation and complete the IMAP configuration (host, port, username, password, mailbox).","Re-save the trigger so inputs are persisted to the automation definition.","Re-create the email trigger if its inputs are missing from the stored definition.","Verify the automation definition doc contains non-empty trigger.inputs."],"exampleFix":"// before\ntrigger: { type: EMAIL, inputs: undefined }\n// after\ntrigger: { type: EMAIL, inputs: { host: \"imap.example.com\", port: 993, username: \"user@example.com\", password: \"pass\", mailbox: \"INBOX\" } }","handlingStrategy":"validation","validationCode":"const inputs = automation.definition.trigger.inputs as EmailTriggerInputs | undefined\nif (!inputs || !inputs.host || !inputs.port) {\n  throw new Error(\"Email trigger IMAP inputs missing; configure host/port/auth before running\")\n}","typeGuard":"const hasImapInputs = (i?: EmailTriggerInputs | null): i is EmailTriggerInputs =>\n  Boolean(i && i.host && i.port)","tryCatchPattern":"try {\n  await checkMail(automationId, imapInputs)\n} catch (e) {\n  if (e.message === \"Email trigger inputs are required\") {\n    // prompt user to complete IMAP configuration in the builder\n  } else throw e\n}","preventionTips":["Complete all IMAP fields when creating the email trigger.","Re-check trigger inputs after importing/exporting apps.","Validate the automation definition's trigger.inputs before manual runs.","Version-check old triggers after upgrades that change input shapes."],"tags":["automation","email","imap","configuration"],"backgroundTag":"missing-config","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}