Budibase/budibase · error · Error

Automation with ID not found

Error message

Automation with ID ${automationId} not found

What it means

Thrown by the `trigger` function in packages/server/src/sdk/workspace/automations/execution.ts when an automation lookup by ID fails. `context.getWorkspaceDB().get<Automation>(automationId)` returned nothing (or the row is falsy), so Budibase aborts before checking trigger types. It protects callers from proceeding with an undefined automation document.

Solutions

  1. Verify the automation ID exists: GET /api/automations in the target workspace and match the _id
  2. Confirm you are calling the correct app/workspace URL and that dev vs prod deployment matches
  3. Re-create the automation if it was deleted, and use the new ID
  4. If using the SDK, ensure context.getWorkspaceDB() is bound to the workspace that owns the automation

Example fix

// before
await sdk.automations.execution.trigger("auto_abcdef")
// after
const automations = await sdk.automations.fetch()
const target = automations.find(a => a._id === "auto_abcdef")
if (!target) throw new Error(`Automation auto_abcdef not found in this workspace`)
await sdk.automations.execution.trigger(target._id!)
Defensive patterns

Strategy: validation

Validate before calling

const exists = (await sdk.automations.fetch()).some(a => a._id === automationId)
if (!exists) throw new Error(`Automation ${automationId} missing`)

Type guard

function isAutomation(a: Automation | undefined): a is Automation {
  return !!a && typeof a._id === "string"
}

Try / catch

try {
  await sdk.automations.execution.trigger(id)
} catch (err: any) {
  if (err.message.includes("not found")) {
    // refetch automations and correct ID
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Calling the manual trigger path (e.g. POST /automations/{id}/trigger or sdk.automations.execution.trigger(id)) with an automation ID that does not exist in the workspace DB — deleted automation, typo'd ID, ID from a different app/workspace, or a prod/dev database mismatch.

Common situations: Developers copy an automation ID from a dev environment and call the API against prod; automations deleted by another user while a UI client still references them; using the internal _id from an export instead of the live document ID; passing an automation ID to the wrong app's API endpoint.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at packages/server/src/sdk/workspace/automations/execution.ts:17

import { context } from "@budibase/backend-core"
import { features } from "@budibase/pro"
import { Automation, AutomationActionStepId } from "@budibase/types"
import sdk from "../.."
import * as triggers from "../../../automations/triggers"
import env from "../../../environment"

export async function trigger(
  automationId: string,
  fields: Record<string, any> = {},
  timeout?: number
) {
  const db = context.getWorkspaceDB()
  const automation = await db.get<Automation>(automationId)

  if (!automation) {
    throw new Error(`Automation with ID ${automationId} not found`)
  }

  // Check if automation has APP trigger (required for manual triggering)
  const triggerType = automation.definition?.trigger?.stepId
  if (triggerType !== "APP") {
    throw new Error(
      `Cannot manually trigger automation '${automation.name}'. Only automations with APP trigger type can be manually triggered. This automation has trigger type: ${triggerType}`
    )
  }

  let hasCollectStep = sdk.automations.utils.checkForCollectStep(automation)
  if (hasCollectStep && (await features.isSyncAutomationsEnabled())) {
    const response = await triggers.externalTrigger(
      automation,
      {
        fields,
        timeout: timeout ? timeout * 1000 : env.AUTOMATION_THREAD_TIMEOUT,
      },

View on GitHub (pinned to a81a902e9a)