{"record":{"id":"037c13ec621e39d2","repo":"Yeachan-Heo/oh-my-codex","slug":"autoresearch-resume-missing-worktree","errorCode":"autoresearch_resume_missing_worktree","errorMessage":"autoresearch_resume_missing_worktree:${manifest.worktree_path}","messagePattern":"autoresearch_resume_missing_worktree:(.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/autoresearch/runtime.ts","lineNumber":974,"sourceCode":"    ledgerFile,\n    latestEvaluatorFile,\n    resultsFile,\n    stateFile,\n    candidateFile,\n    repoRoot: projectRoot,\n    worktreePath,\n    taskDescription,\n  };\n}\n\nexport async function resumeAutoresearchRuntime(projectRoot: string, runId: string): Promise<PreparedAutoresearchRuntime> {\n  await assertAutoresearchLockAvailable(projectRoot);\n  const manifest = await loadAutoresearchRunManifest(projectRoot, runId);\n  if (manifest.status !== 'running') {\n    throw new Error(`autoresearch_resume_terminal_run:${runId}`);\n  }\n  if (!existsSync(manifest.worktree_path)) {\n    throw new Error(`autoresearch_resume_missing_worktree:${manifest.worktree_path}`);\n  }\n  await ensureRuntimeExcludes(manifest.worktree_path);\n  await ensureAutoresearchWorktreeDependencies(projectRoot, manifest.worktree_path);\n  assertResetSafeWorktree(manifest.worktree_path);\n  await startMode('autoresearch', `autoresearch resume ${runId}`, 1, projectRoot);\n  await activateAutoresearchRun(manifest);\n  await updateModeState('autoresearch', {\n    current_phase: 'running',\n    run_id: manifest.run_id,\n    run_tag: manifest.run_tag,\n    mission_dir: manifest.mission_dir,\n    mission_file: manifest.mission_file,\n    sandbox_file: manifest.sandbox_file,\n    mission_slug: manifest.mission_slug,\n    repo_root: manifest.repo_root,\n    worktree_path: manifest.worktree_path,\n    baseline_commit: manifest.baseline_commit,\n    last_kept_commit: manifest.last_kept_commit,","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/autoresearch/runtime.ts#L956-L992","documentation":"resumeAutoresearchRuntime throws (code autoresearch_resume_missing_worktree) when the worktree directory recorded in the manifest no longer exists on disk. The run is nominally still 'running' but its working directory was deleted, so resume cannot continue in place.","triggerScenarios":"Calling resumeAutoresearchRuntime when manifest.worktree_path has been removed — manual cleanup of worktree directories, `git worktree prune`, OS temp-dir cleaners, or a checkout on another machine that never had the worktree.","commonSituations":"Disk cleanup tools removing .omx worktrees, running `git worktree prune` while a run is paused, resuming on a different machine/clone, or the worktree path living under /tmp and being wiped on reboot.","solutions":["Check whether manifest.worktree_path (printed in the message) exists; if it was merely moved, recreate it at that exact path or update the manifest carefully","If deleted, the run cannot be resumed in place — start a new autoresearch run from the repo root","Prevent recurrence: keep worktrees out of temp directories and avoid `git worktree prune` while runs are paused","If resuming on another machine, first restore the .omx state and worktree to identical paths"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nconst manifest = await loadAutoresearchRunManifest(repoRoot, runId);\nif (!existsSync(manifest.worktree_path)) {\n  throw new Error(`Worktree ${manifest.worktree_path} missing; run cannot be resumed.`);\n}","typeGuard":null,"tryCatchPattern":"try { await resumeAutoresearchRuntime(repoRoot, runId); }\ncatch (e) { if (e instanceof Error && e.message.startsWith('autoresearch_resume_missing_worktree')) { /* recreate worktree at the recorded path or start a new run */ } throw e; }","preventionTips":["Keep autoresearch worktrees out of /tmp and OS-cleaned directories","Never run `git worktree prune` while runs are paused","Resume on the same machine/clone where the run started"],"tags":["autoresearch","worktree","missing-directory","resume"],"backgroundTag":"missing-worktree-directory","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}