{"record":{"id":"ca6c386253f8c5b6","repo":"stablyai/orca","slug":"unknown-ephemeral-vm-runtime-args-runtimeid-ca6c38","errorCode":null,"errorMessage":"Unknown ephemeral VM runtime: ${args.runtimeId}","messagePattern":"Unknown ephemeral VM runtime: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/ipc/ephemeral-vm-runtime-handlers.ts","lineNumber":71,"sourceCode":"  ipcMain.handle(\n    'ephemeralVm:attachWorkspace',\n    (_event, args: { runtimeId: string; workspaceId: string }): EphemeralVmRuntimeRecord => {\n      return updateEphemeralVmRuntimeStatus(app.getPath('userData'), args.runtimeId, {\n        status: 'running',\n        workspaceId: args.workspaceId\n      })\n    }\n  )\n\n  ipcMain.handle(\n    'ephemeralVm:cleanup',\n    async (_event, args: { runtimeId: string }): Promise<EphemeralVmRuntimeRecord> => {\n      const userDataPath = app.getPath('userData')\n      const runtime = listEphemeralVmRuntimes(userDataPath).find(\n        (entry) => entry.id === args.runtimeId\n      )\n      if (!runtime) {\n        throw new Error(`Unknown ephemeral VM runtime: ${args.runtimeId}`)\n      }\n      if (!runtime.repoId) {\n        throw new Error(`Ephemeral VM runtime has no repo id: ${args.runtimeId}`)\n      }\n      let resolved: ReturnType<typeof getRuntimeRecipeContext>\n      try {\n        resolved = getRuntimeRecipeContext(store, userDataPath, runtime.id)\n      } catch (error) {\n        return updateEphemeralVmRuntimeStatus(userDataPath, runtime.id, {\n          status: 'cleanup_failed',\n          cleanupStatus: 'failed',\n          cleanupLastAttemptAt: Date.now(),\n          cleanupLastError: error instanceof Error ? error.message : String(error)\n        })\n      }\n      const result = await cleanupEphemeralVmRuntime({\n        userDataPath,\n        repoPath: resolved.repo.repo.path,","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/ephemeral-vm-runtime-handlers.ts#L53-L89","documentation":"Thrown by the `ephemeralVm:cleanup` IPC handler when `listEphemeralVmRuntimes(userDataPath).find(id === args.runtimeId)` returns undefined. This is a defensive pre-check before delegating to `getRuntimeRecipeContext`; it lets the handler return a `cleanup_failed` status update rather than propagating the recipe-context error. Identical in cause to 1106 but at the IPC handler boundary.","triggerScenarios":"Invoking `ipcRenderer.invoke('ephemeralVm:cleanup', { runtimeId })` for a runtime id that is not in the persisted runtime store (already cleaned, expired, wrong profile, or typo).","commonSituations":"User clicks cleanup on a runtime list that is stale; double-cleanup (the record was already removed by a prior call); runtime id from a different userData profile; id corrupted in transit.","solutions":["Refresh the runtime list before offering cleanup actions so only live ids are selectable.","Treat 'Unknown ephemeral VM runtime' on cleanup as a no-op success (the runtime is already gone).","Verify the runtimeId matches a record from `listEphemeralVmRuntimes` for the current profile before invoking."],"exampleFix":"// before\nawait ipcRenderer.invoke('ephemeralVm:cleanup', { runtimeId: cachedId })\n\n// after\nconst live = await ipcRenderer.invoke('ephemeralVm:listRuntimes')\nif (!live.some((r) => r.id === cachedId)) {\n  // already cleaned up; nothing to do\n  return { status: 'already_clean' }\n}\nawait ipcRenderer.invoke('ephemeralVm:cleanup', { runtimeId: cachedId })","handlingStrategy":"validation","validationCode":"// Refresh the runtime list before offering cleanup; only invoke for live ids.\nconst live = await ipcRenderer.invoke('ephemeralVm:listRuntimes')\nif (!live.some((r) => r.id === runtimeId)) {\n  // already cleaned up; treat as success\n  return { status: 'already_clean' }\n}\nawait ipcRenderer.invoke('ephemeralVm:cleanup', { runtimeId })","typeGuard":"function runtimeIdIsLive(list: { id: string }[], id: string): boolean {\n  return list.some((r) => r.id === id)\n}","tryCatchPattern":"try {\n  await ipcRenderer.invoke('ephemeralVm:cleanup', { runtimeId })\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unknown ephemeral VM runtime:')) {\n    // already gone; nothing to clean\n    return\n  }\n  throw e\n}","preventionTips":["Make cleanup idempotent in the UI: a missing runtime is a success, not an error.","Disable the cleanup action for runtimes no longer in the live list.","Avoid double-cleanup by tracking in-flight cleanup requests per runtime id."],"tags":["ephemeral-vm","runtime","cleanup","ipc","state"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}