Budibase/budibase · error

automationId and appId are required

Error message

automationId and appId are required

What it means

clearAutomationLogErrors in the builder automations store requires both automationId and appId to call the API that clears an automation's log errors. If either is falsy it throws 'automationId and appId are required'. This is a fast-fail argument validation to avoid an API call with an invalid URL.

Source

Thrown at packages/builder/src/stores/builder/automations.ts:1617

    page?: string
  } = {}) => {
    return await API.getAutomationLogs({
      automationId,
      startDate,
      status,
      page,
    })
  },

  clearLogErrors: async ({
    automationId,
    appId,
  }: {
    automationId: string
    appId: string
  }) => {
    if (!automationId || !appId) {
      throw new Error("automationId and appId are required")
    }
    return await API.clearAutomationLogErrors(automationId, appId)
  },

  addTestDataToAutomation: (data: any) => {
    let newAutomation = cloneDeep(get(selectedAutomation)?.data)
    if (!newAutomation) {
      return newAutomation
    }
    newAutomation.testData = {
      ...newAutomation.testData,
      ...data,
    }
    return newAutomation
  },

  constructBlock: (
    type: BlockDefinitionTypes,

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Pass both automationId and appId explicitly when calling clearAutomationLogErrors.
  2. Gate the UI action until an automation is selected and the app id is available.
  3. Derive appId from the route/store before invoking instead of relying on optional context.

Example fix

// before
await automationActions.clearAutomationLogErrors({ automationId: selected?._id })
// after
await automationActions.clearAutomationLogErrors({ automationId: selected._id, appId: getAppId() })
Defensive patterns

Strategy: validation

Validate before calling

const id = get(selectedAutomation)?._id
const appId = getAppId()
if (!id || !appId) return // don't call; nothing selected or app context not ready
await automationActions.clearAutomationLogErrors({ automationId: id, appId })

Type guard

const canClearErrors = (p: { automationId?: string; appId?: string }): p is { automationId: string; appId: string } =>
  typeof p.automationId === "string" && p.automationId.length > 0 && typeof p.appId === "string" && p.appId.length > 0

Try / catch

try {
  await automationActions.clearAutomationLogErrors({ automationId, appId })
} catch (e) {
  if (e.message === "automationId and appId are required") {
    console.warn("No automation/app selected; skipping clear errors")
    return
  }
  throw e
}

Prevention

When it happens

Trigger: Invoking automationActions.clearAutomationLogErrors({ automationId, appId }) with either field undefined/empty — e.g. clear-all-errors clicked before an automation is selected, or appId not yet loaded in the route/store context.

Common situations: Calling from a shared component used outside the automations screen; running the action during initial page load before route params resolve; programmatic store use where appId was never passed in.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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