{"record":{"id":"0c3712990fd1fd6b","repo":"Budibase/budibase","slug":"automationid-and-appid-are-required","errorCode":null,"errorMessage":"automationId and appId are required","messagePattern":"automationId and appId are required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/builder/src/stores/builder/automations.ts","lineNumber":1617,"sourceCode":"    page?: string\n  } = {}) => {\n    return await API.getAutomationLogs({\n      automationId,\n      startDate,\n      status,\n      page,\n    })\n  },\n\n  clearLogErrors: async ({\n    automationId,\n    appId,\n  }: {\n    automationId: string\n    appId: string\n  }) => {\n    if (!automationId || !appId) {\n      throw new Error(\"automationId and appId are required\")\n    }\n    return await API.clearAutomationLogErrors(automationId, appId)\n  },\n\n  addTestDataToAutomation: (data: any) => {\n    let newAutomation = cloneDeep(get(selectedAutomation)?.data)\n    if (!newAutomation) {\n      return newAutomation\n    }\n    newAutomation.testData = {\n      ...newAutomation.testData,\n      ...data,\n    }\n    return newAutomation\n  },\n\n  constructBlock: (\n    type: BlockDefinitionTypes,","sourceCodeStart":1599,"sourceCodeEnd":1635,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/builder/src/stores/builder/automations.ts#L1599-L1635","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass both automationId and appId explicitly when calling clearAutomationLogErrors.","Gate the UI action until an automation is selected and the app id is available.","Derive appId from the route/store before invoking instead of relying on optional context."],"exampleFix":"// before\nawait automationActions.clearAutomationLogErrors({ automationId: selected?._id })\n// after\nawait automationActions.clearAutomationLogErrors({ automationId: selected._id, appId: getAppId() })","handlingStrategy":"validation","validationCode":"const id = get(selectedAutomation)?._id\nconst appId = getAppId()\nif (!id || !appId) return // don't call; nothing selected or app context not ready\nawait automationActions.clearAutomationLogErrors({ automationId: id, appId })","typeGuard":"const canClearErrors = (p: { automationId?: string; appId?: string }): p is { automationId: string; appId: string } =>\n  typeof p.automationId === \"string\" && p.automationId.length > 0 && typeof p.appId === \"string\" && p.appId.length > 0","tryCatchPattern":"try {\n  await automationActions.clearAutomationLogErrors({ automationId, appId })\n} catch (e) {\n  if (e.message === \"automationId and appId are required\") {\n    console.warn(\"No automation/app selected; skipping clear errors\")\n    return\n  }\n  throw e\n}","preventionTips":["Disable clear-errors actions until an automation is selected and the app id is loaded.","Resolve appId from the route/store at call time rather than optional parameters.","Add early returns in handlers when selection state is incomplete."],"tags":["validation","automations","builder"],"backgroundTag":"missing-required-parameter","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}