stablyai/orca · error · Error

Automation run not found.

Error message

Automation run not found.

What it means

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.

Source

Thrown at src/main/automations/service.ts:103

  }

  async runNow(automationId: string): Promise<AutomationRun> {
    const automation = this.store.listAutomations().find((entry) => entry.id === automationId)
    if (!automation) {
      throw new Error('Automation not found.')
    }
    const run = this.store.createAutomationRun(automation, Date.now(), 'manual')
    return await this.requestDispatch(automation, run)
  }

  async runPrecheck(automationId: string, runId: string): Promise<AutomationPrecheckResult | null> {
    const automation = this.store.listAutomations().find((entry) => entry.id === automationId)
    if (!automation) {
      throw new Error('Automation not found.')
    }
    const run = this.store.listAutomationRuns(automationId).find((entry) => entry.id === runId)
    if (!run) {
      throw new Error('Automation run not found.')
    }
    if (run.trigger !== 'scheduled' || !automation.precheck) {
      return null
    }
    const target = resolveAutomationRunTarget(this.store, automation, {
      allowRemoteHostScheduling: this.allowRemoteHostScheduling
    })
    if (!target.ok) {
      return {
        command: automation.precheck.command,
        exitCode: null,
        timedOut: false,
        durationMs: 0,
        stdout: '',
        stderr: '',
        stdoutTruncated: false,
        stderrTruncated: false,
        error: target.error,

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Capture the runId returned by createAutomationRun/runNow and pass that exact value to runPrecheck.
  2. Verify the run exists in listAutomationRuns(automationId) before calling runPrecheck.
  3. Increase run-history retention if runs age out before precheck runs.
  4. Catch the Error and surface 'run record expired or missing' to the caller.

Example fix

// before
await automationService.runPrecheck(automationId, runIdFromUrl)

// after
const run = automationService
  .listAutomationRuns(automationId)
  .find((r) => r.id === runIdFromUrl)
if (!run) {
  return { skipped: true, reason: 'run-record-missing' }
}
await automationService.runPrecheck(automationId, runIdFromUrl)
Defensive patterns

Strategy: validation

Validate before calling

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)

Try / catch

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}

Prevention

When it happens

Trigger: Calling runPrecheck with a runId that was never created, was deleted/pruned, belongs to a different automation, or is a stale/typo'd ID.

Common situations: 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.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/280618fe154a656a. Report an issue: GitHub.