{"record":{"id":"d95f2072cdcf4866","repo":"coleam00/Archon","slug":"cannot-resume-the-working-path-from-the-run-no-lo","errorCode":null,"errorMessage":"Cannot resume: the working path from the run no longer exists: ${resumable.working_path}\nThe worktree may have been cleaned up. Start a fresh run with --branch instead.","messagePattern":"Cannot resume: the working path from the run no longer exists: (.+?)\nThe worktree may have been cleaned up\\. Start a fresh run with --branch instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":2407,"sourceCode":"    getLog().info(\n      {\n        workflowRunId: resumable.id,\n        workflowName,\n        workingPath: resumable.working_path,\n      },\n      'workflow.resume_found_resumable'\n    );\n\n    // A container run IS resumable (Phase C): the overlay lives on a persisted\n    // volume the resume rediscovers and restarts (see the folder branch below,\n    // which calls backend.resumeEnv when `resumable.metadata.isolation` is\n    // 'container'). Nothing to reject here anymore.\n\n    // Reuse the working path from the resumable run (verify it still exists)\n    if (resumable.working_path) {\n      const { existsSync } = await import('fs');\n      if (!existsSync(resumable.working_path)) {\n        throw new Error(\n          `Cannot resume: the working path from the run no longer exists: ${resumable.working_path}\\n` +\n            'The worktree may have been cleaned up. Start a fresh run with --branch instead.'\n        );\n      }\n      workingCwd = resumable.working_path;\n    }\n\n    // Look up the isolation environment that owns this working path (if any)\n    const allEnvs = await isolationDb.listByCodebase(codebase.id);\n    const matchingEnv = allEnvs.find(e => e.working_path === workingCwd);\n    if (matchingEnv) {\n      isolationEnvId = matchingEnv.id;\n      getLog().info(\n        { envId: isolationEnvId, workingPath: workingCwd },\n        'workflow.resume_env_found'\n      );\n    }\n","sourceCodeStart":2389,"sourceCodeEnd":2425,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L2389-L2425","documentation":"During --resume, the CLI reuses the prior run's working_path (its worktree) instead of cutting a new one. If that path no longer exists on disk — typically because the worktree was pruned by `git worktree remove`, a cleanup job, or manual deletion — resuming would silently run against a wrong/fresh directory, so the CLI fails with this message and points to starting a fresh --branch run instead.","triggerScenarios":"Running `archon workflow run <flow> --resume` where the resumable run row has a working_path and existsSync(working_path) returns false: worktree cleaned up, disk path moved, run originated on another machine/container whose paths do not exist locally.","commonSituations":"Running `git worktree prune` or a repo cleanup between attempts; deleting .archon worktrees to free space; resuming a run recorded on a different host with different absolute paths.","solutions":["Check if the worktree is recoverable: `git worktree list` and re-add it at the same path if the branch still exists.","If the branch survives, run `git worktree add <path> <branch>` to restore it, then resume again.","Otherwise start a fresh run with --branch (as the message advises) and re-apply any uncommitted work manually.","Verify the run's working_path in `archon workflow get <id>` matches a real directory before resuming."],"exampleFix":"// before\narchon workflow run my-flow --resume  # working path no longer exists: /repo/.archon/worktrees/my-flow-123\n// after\ngit worktree add /repo/.archon/worktrees/my-flow-123 my-flow-123\narchon workflow run my-flow --resume","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\n// fetch the resumable run first, then check its working_path\nconst run = await workflowDb.getWorkflowRun(id);\nif (run?.working_path && !existsSync(run.working_path)) {\n  console.error(`Worktree ${run.working_path} is gone; re-add it or start fresh with --branch.`);\n}","typeGuard":"function hasLiveWorkingPath(r: { working_path: string | null }): r is { working_path: string } {\n  return typeof r.working_path === 'string' && existsSync(r.working_path);\n}","tryCatchPattern":"try {\n  await runWorkflow({ resume: true });\n} catch (error) {\n  if ((error as Error).message.includes('working path from the run no longer exists')) {\n    const path = /no longer exists: (\\S+)/.exec((error as Error).message)?.[1];\n    console.error(`Restore the worktree at ${path} via 'git worktree add', or start fresh with --branch.`);\n  } else throw error;\n}","preventionTips":["Do not run `git worktree prune` while runs reference worktrees.","Check `archon workflow get <id>` working_path exists before resuming.","Resume on the same machine/container where the run was created.","Keep the .archon worktree directory out of cleanup scripts."],"tags":["filesystem","worktree","resume","cli"],"backgroundTag":"worktree-missing","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}