stablyai/orca · error

Unknown ephemeral VM runtime: ${args.runtimeId}

Error message

Unknown ephemeral VM runtime: ${args.runtimeId}

What it means

cleanupEphemeralVmRuntime looks up the runtime by id in listEphemeralVmRuntimes(userDataPath); a miss means the id was never created, was already cleaned, or points at a different userDataPath. The error throws before any destroy recipe logic runs.

Source

Thrown at src/main/ephemeral-vm-runtime-service.ts:147

    connectionMode: connection.type,
    cleanupStatus: args.recipe.destroyDisabled ? 'disabled' : 'not_started',
    ...(args.recipe.destroyDisabled ? { cleanupDisabled: true } : {}),
    createdAt: now,
    updatedAt: now,
    recipeResult: start.result
  })

  return { ok: true, start, runtime }
}

export async function cleanupEphemeralVmRuntime(
  args: CleanupEphemeralVmRuntimeArgs
): Promise<CleanupEphemeralVmRuntimeResult> {
  const existing = listEphemeralVmRuntimes(args.userDataPath).find(
    (entry) => entry.id === args.runtimeId
  )
  if (!existing) {
    throw new Error(`Unknown ephemeral VM runtime: ${args.runtimeId}`)
  }

  const now = args.now ?? Date.now()
  const running = updateEphemeralVmRuntimeStatus(args.userDataPath, existing.id, {
    status: 'cleanup_pending',
    cleanupStatus: args.recipe.destroyDisabled ? 'disabled' : 'running',
    cleanupLastAttemptAt: now,
    cleanupLastError: null,
    updatedAt: now
  })
  const cleanup = await runEphemeralVmRecipeCleanup({
    repoPath: args.repoPath,
    recipe: args.recipe,
    context: contextFromRuntime(args.repoPath, running),
    recipeResult: running.recipeResult,
    signal: args.signal,
    onStdout: args.onStdout,
    onStderr: args.onStderr

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Check the runtime still exists via listEphemeralVmRuntimes(userDataPath) before calling cleanup.
  2. Pass the same userDataPath that was used to start the runtime.
  3. Treat 'unknown runtime' as already-cleaned and make cleanup idempotent in the caller.

Example fix

// before
await cleanupEphemeralVmRuntime({ runtimeId, userDataPath, recipe, repoPath })

// after
const exists = listEphemeralVmRuntimes(userDataPath).some((r) => r.id === runtimeId)
if (exists) await cleanupEphemeralVmRuntime({ runtimeId, userDataPath, recipe, repoPath })
Defensive patterns

Strategy: validation

Validate before calling

const exists = listEphemeralVmRuntimes(userDataPath).some((r) => r.id === runtimeId)
if (!exists) { /* already cleaned or wrong path; skip */ }

Type guard

function isUnknownRuntimeError(e: unknown): boolean {
  return e instanceof Error && /^Unknown ephemeral VM runtime:/.test(e.message)
}

Try / catch

try { await cleanupEphemeralVmRuntime(args) }
catch (e) { if (isUnknownRuntimeError(e)) { /* idempotent: already gone */ } else throw e }

Prevention

When it happens

Trigger: Calling cleanupEphemeralVmRuntime({ runtimeId, userDataPath, ... }) where no record's id matches args.runtimeId (ephemeral-vm-runtime-service.ts:143-147).

Common situations: Double-cleanup (runtime already destroyed); wrong userDataPath (different user/install); an id copied from a different workspace; the runtime record file was deleted out of band.

Related errors


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