{"record":{"id":"2e46ef5e86cd3b71","repo":"Budibase/budibase","slug":"no-trigger-found-for-automation","errorCode":null,"errorMessage":"No trigger found for automation","messagePattern":"No trigger found for automation","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/api/controllers/automation.ts","lineNumber":249,"sourceCode":"  }\n\n  if (!automationId) {\n    throw new HTTPError(\n      \"Automation ID is required to test a saved password\",\n      400\n    )\n  }\n\n  const automation = await context\n    .getWorkspaceDB()\n    .tryGet<Automation>(automationId)\n  if (!automation) {\n    throw new HTTPError(\"Automation not found\", 404)\n  }\n\n  const trigger = automation.definition.trigger\n  if (!trigger) {\n    throw new HTTPError(\"No trigger found for automation\", 400)\n  }\n  if (!isEmailTrigger(trigger)) {\n    throw new HTTPError(\"Automation trigger is not an email trigger\", 400)\n  }\n  if (!trigger.inputs.password) {\n    throw new HTTPError(\"IMAP password is required\", 400)\n  }\n\n  const stored = trigger.inputs\n  const connectionMatches =\n    emailInputs.host === stored.host &&\n    emailInputs.port === stored.port &&\n    emailInputs.username === stored.username &&\n    emailInputs.secure === stored.secure\n  if (!connectionMatches) {\n    throw new HTTPError(\n      \"IMAP password is required when connection details change\",\n      400","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/automation.ts#L231-L267","documentation":"The resolved automation has no trigger defined in automation.definition.trigger. Hydrating a saved IMAP password requires reading the email trigger's stored inputs, so the request is rejected with HTTP 400.","triggerScenarios":"testEmailConnection on an automation whose definition lacks a trigger — e.g. an automation saved with only actions, a corrupt definition, or a manually crafted automation document.","commonSituations":"Automations created/edited via API or import with an incomplete definition; definitions produced by older versions before the trigger field shape stabilized.","solutions":["Open the automation in the builder and ensure a trigger (e.g. Email trigger) is attached, then re-save","Inspect the automation document and fix/repair the definition.trigger field","Test with a different, correctly configured email automation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!automation.definition?.trigger) throw new Error('Automation has no trigger; cannot test email connection')","typeGuard":"function hasTrigger(a: Automation): a is Automation & { definition: { trigger: NonNullable<Automation['definition']['trigger']> } } {\n  return a.definition?.trigger != null\n}","tryCatchPattern":"try {\n  await testEmailConnection({ emailInputs, automationId })\n} catch (e) {\n  if (e.status === 400 && e.message.includes('No trigger found')) {\n    // repair the automation definition before testing\n  }\n}","preventionTips":["Validate automation definitions (trigger present) before saving or importing them","Re-save automations through the builder rather than hand-editing documents","Check for definition-shape changes after version upgrades"],"tags":["automation","trigger","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}