{"record":{"id":"5ed31ce91ff0cbd7","repo":"Budibase/budibase","slug":"automation-not-found-5ed31c","errorCode":null,"errorMessage":"Automation not found","messagePattern":"Automation not found","errorType":"http","errorClass":"HTTPError","httpStatus":404,"severity":"error","filePath":"packages/server/src/api/controllers/webhook.ts","lineNumber":84,"sourceCode":"\nconst assertSchemaWorkspace = (instance: string) => {\n  if (dbCore.isDevWorkspaceID(instance)) {\n    return\n  }\n\n  throw new HTTPError(\"Webhook schema can only be built in development\", 400)\n}\n\nconst updateWebhookSchema = async (\n  body: BuildWebhookSchemaRequest,\n  webhook: Webhook,\n  db: ReturnType<typeof context.getWorkspaceDB>\n) => {\n  webhook.bodySchema = toJsonSchema(body)\n  if (webhook.action.type === WebhookActionType.AUTOMATION) {\n    const automation = await db.tryGet<Automation>(webhook.action.target)\n    if (!automation) {\n      throw new HTTPError(\"Automation not found\", 404)\n    }\n    const autoOutputs = automation.definition.trigger.schema.outputs\n    const properties = webhook.bodySchema?.properties\n    autoOutputs.properties = {\n      body: autoOutputs.properties.body,\n    }\n    for (let prop of Object.keys(properties || {})) {\n      if (properties?.[prop] == null) {\n        continue\n      }\n      const def = properties[prop]\n      if (typeof def === \"boolean\") {\n        continue\n      }\n      autoOutputs.properties[prop] = {\n        type: def.type as AutomationIOType,\n        description: AUTOMATION_DESCRIPTION,\n      }","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/webhook.ts#L66-L102","documentation":"When a webhook of type AUTOMATION has its body schema updated, the controller loads the target automation document from the workspace DB using tryGet (which returns null instead of throwing). If no automation document matches webhook.action.target, a 404 HTTPError is thrown.","triggerScenarios":"Webhook action target points to an automation ID that no longer exists in the workspace DB (automation deleted, webhook copied across apps, wrong target stored in the webhook doc).","commonSituations":"Deleting an automation without removing its webhook; exporting/importing an app where the webhook doc references an automation from another app; manually editing webhook docs in CouchDB.","solutions":["Recreate the webhook pointing at an existing automation (or delete the stale webhook).","Verify webhook.action.target matches an existing automation _id in the workspace DB (Fauxton/direct DB check).","Re-sync the webhook by re-saving the automation trigger so the webhook doc is regenerated.","Restore the deleted automation from a backup if it is still needed."],"exampleFix":"// before\nwebhook.action.target = \"auto_deleted123\"\n// after\nwebhook.action.target = existingAutomation._id","handlingStrategy":"try-catch","validationCode":"const db = context.getWorkspaceDB()\nconst automation = await db.tryGet<Automation>(webhook.action.target)\nif (!automation) throw new Error(`Automation ${webhook.action.target} missing; fix webhook before schema build`)","typeGuard":"const hasAutomation = async (db: any, id: string) =>\n  Boolean(await db.tryGet<Automation>(id))","tryCatchPattern":"try {\n  await buildWebhookSchema(appId, webhookId)\n} catch (e) {\n  if (e.status === 404 && e.message === \"Automation not found\") {\n    // delete/recreate the webhook or rebind webhook.action.target\n  } else throw e\n}","preventionTips":["Delete webhooks when deleting their automations.","Never copy webhook docs between apps; recreate them.","After imports, verify webhook action targets resolve to existing automations.","Use the builder UI to manage webhooks so bindings stay consistent."],"tags":["webhook","automation","http-404","not-found"],"backgroundTag":"referenced-resource-missing","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}