{"record":{"id":"7dfa0f2d11fed35e","repo":"Budibase/budibase","slug":"email-trigger-inputs-are-required-7dfa0f","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/utils/getClient.ts","lineNumber":102,"sourceCode":"    return {\n      user: inputs.username,\n      accessToken,\n    }\n  }\n\n  if (!inputs.password) {\n    throw new Error(\"IMAP password is required\")\n  }\n\n  return {\n    user: inputs.username,\n    pass: inputs.password,\n  }\n}\n\nexport const getClient = async (inputs: EmailTriggerInputs) => {\n  if (!inputs) {\n    throw new Error(\"Email trigger inputs are required\")\n  }\n\n  if (await blacklist.isBlacklisted(inputs.host)) {\n    throw new Error(\"IMAP host is blocked or could not be resolved safely\")\n  }\n\n  const client = new ImapFlow({\n    host: inputs.host,\n    port: inputs.port,\n    secure: inputs.secure,\n    auth: await getAuthConfig(inputs),\n    // imap flow has its own pino instance enabled by default and is very very chatty!\n    logger: false,\n  })\n\n  return client\n}\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/automations/email/utils/getClient.ts#L84-L120","documentation":"getClient guards against being invoked with no inputs at all before doing anything else. Passing null/undefined for the EmailTriggerInputs object means no host, credentials, or connection settings exist, so it throws immediately.","triggerScenarios":"Calling getClient(null) or getClient(undefined), typically from automation code paths where the trigger's inputs object failed to build or was not passed through.","commonSituations":"Programmatic/step invocation of the email client with a malformed automation step definition; upstream code that destructures and drops inputs; tests calling getClient directly without fixtures.","solutions":["Ensure the automation trigger definition contains a valid inputs object before execution","Check upstream code that constructs EmailTriggerInputs and confirm it always returns an object","In custom code, validate inputs exist before calling getClient"],"exampleFix":"// before\nconst client = await getClient(inputs) // inputs may be undefined\n// after\nif (!inputs) throw new Error(\"inputs missing\")\nconst client = await getClient(inputs)","handlingStrategy":"validation","validationCode":"if (!inputs || typeof inputs !== \"object\") {\n  throw new Error(\"Email trigger inputs must be provided\")\n}","typeGuard":"function hasInputs(inputs: unknown): inputs is EmailTriggerInputs {\n  return typeof inputs === \"object\" && inputs !== null && \"host\" in inputs\n}","tryCatchPattern":null,"preventionTips":["Never call getClient with a possibly-undefined value; validate trigger payloads first","Keep trigger definition schemas intact when editing automations programmatically","Add input checks in custom automation code paths"],"tags":["email","automation","validation","guard"],"backgroundTag":"missing-required-argument","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}