{"record":{"id":"280618fe154a656a","repo":"stablyai/orca","slug":"automation-run-not-found","errorCode":null,"errorMessage":"Automation run not found.","messagePattern":"Automation run not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/automations/service.ts","lineNumber":103,"sourceCode":"  }\n\n  async runNow(automationId: string): Promise<AutomationRun> {\n    const automation = this.store.listAutomations().find((entry) => entry.id === automationId)\n    if (!automation) {\n      throw new Error('Automation not found.')\n    }\n    const run = this.store.createAutomationRun(automation, Date.now(), 'manual')\n    return await this.requestDispatch(automation, run)\n  }\n\n  async runPrecheck(automationId: string, runId: string): Promise<AutomationPrecheckResult | null> {\n    const automation = this.store.listAutomations().find((entry) => entry.id === automationId)\n    if (!automation) {\n      throw new Error('Automation not found.')\n    }\n    const run = this.store.listAutomationRuns(automationId).find((entry) => entry.id === runId)\n    if (!run) {\n      throw new Error('Automation run not found.')\n    }\n    if (run.trigger !== 'scheduled' || !automation.precheck) {\n      return null\n    }\n    const target = resolveAutomationRunTarget(this.store, automation, {\n      allowRemoteHostScheduling: this.allowRemoteHostScheduling\n    })\n    if (!target.ok) {\n      return {\n        command: automation.precheck.command,\n        exitCode: null,\n        timedOut: false,\n        durationMs: 0,\n        stdout: '',\n        stderr: '',\n        stdoutTruncated: false,\n        stderrTruncated: false,\n        error: target.error,","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/automations/service.ts#L85-L121","documentation":"Thrown by AutomationService.runPrecheck when the automation exists but no run in store.listAutomationRuns(automationId) matches runId. The automation was found, but the specific run record (created by a prior dispatch or scheduling tick) is missing.","triggerScenarios":"Calling runPrecheck with a runId that was never created, was deleted/pruned, belongs to a different automation, or is a stale/typo'd ID.","commonSituations":"Run history was pruned to a cap and the referenced run aged out, a runId reconstructed from logs, a race where the run record isn't yet persisted, or a runId from a different automation.","solutions":["Capture the runId returned by createAutomationRun/runNow and pass that exact value to runPrecheck.","Verify the run exists in listAutomationRuns(automationId) before calling runPrecheck.","Increase run-history retention if runs age out before precheck runs.","Catch the Error and surface 'run record expired or missing' to the caller."],"exampleFix":"// before\nawait automationService.runPrecheck(automationId, runIdFromUrl)\n\n// after\nconst run = automationService\n  .listAutomationRuns(automationId)\n  .find((r) => r.id === runIdFromUrl)\nif (!run) {\n  return { skipped: true, reason: 'run-record-missing' }\n}\nawait automationService.runPrecheck(automationId, runIdFromUrl)","handlingStrategy":"validation","validationCode":"const run = automationService\\n  .listAutomationRuns(automationId)\\n  .find((r) => r.id === runId)\\nif (!run) {\\n  return { skipped: true, reason: 'run-record-missing' }\\n}\\nawait automationService.runPrecheck(automationId, runId)","typeGuard":null,"tryCatchPattern":"try {\\n  await automationService.runPrecheck(automationId, runId)\\n} catch (err) {\\n  if ((err as Error).message === 'Automation run not found.') {\\n    log.warn('run record missing', { automationId, runId })\\n    return\\n  }\\n  throw err\\n}","preventionTips":["Pass the runId returned by createAutomationRun/runNow verbatim.","Verify the run exists before precheck.","Increase run-history retention if runs age out.","Avoid reconstructing runIds from external sources."],"tags":["automation","not-found","precheck","run-history","state"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}