{"record":{"id":"516790315ab34c60","repo":"coleam00/Archon","slug":"status-failed-err-message","errorCode":null,"errorMessage":"  Status: Failed - ${err.message}","messagePattern":"  Status: Failed - (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/isolation.ts","lineNumber":154,"sourceCode":"      console.log(`  Status: Skipped — run ${liveRun.id.slice(0, 8)} is ${liveRun.status}`);\n      skipped++;\n      continue;\n    }\n\n    try {\n      await provider.destroy(env.working_path, {\n        branchName: env.branch_name ? toBranchName(env.branch_name) : undefined,\n        canonicalRepoPath: toRepoPath(env.codebase_default_cwd),\n      });\n\n      await isolationDb.updateStatus(env.id, 'destroyed');\n      console.log('  Status: Cleaned');\n      cleaned++;\n    } catch (error) {\n      const err = error as Error;\n      getLog().warn({ err, envId: env.id, path: env.working_path }, 'worktree_destroy_failed');\n      console.error(`  Status: Failed - ${err.message}`);\n      failed++;\n    }\n  }\n\n  console.log(\n    `\\nCleanup complete: ${String(cleaned)} cleaned, ${String(skipped)} skipped, ${String(failed)} failed`\n  );\n\n  // Reap orphaned container environments (terminal / run-less, older than the\n  // threshold). Paused runs' containers are deliberately skipped (awaited state).\n  const containerReport = await cleanupContainerEnvironments(daysStale);\n  const containerTotal =\n    containerReport.removed.length + containerReport.skipped.length + containerReport.errors.length;\n  if (containerTotal > 0) {\n    console.log('\\nContainer environments:');\n    for (const id of containerReport.removed) {\n      console.log(`  Removed: ${id.slice(0, 8)}`);\n    }\n    for (const s of containerReport.skipped) {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/isolation.ts#L136-L172","documentation":"isolationCleanupCommand prints this per-environment failure line when destroying a git worktree/execution environment fails during `archon isolation cleanup`. The underlying error is logged as 'worktree_destroy_failed' with the env id and path; the message surfaces err.message to the operator and the summary counts it as failed.","triggerScenarios":"Running `archon isolation cleanup` when worktree destruction throws — the working_path no longer exists, permissions deny removal, files are held open/locked by a running process, or the git repo/worktree metadata is corrupt or already pruned.","commonSituations":"A workflow run still holds the worktree open (editor, dev server, agent process); the checkout was deleted manually out from under Archon; running cleanup without filesystem permissions; stale worktrees on an unmounted volume.","solutions":["Close processes holding the worktree open (check the logged path in 'worktree_destroy_failed'), then re-run cleanup","If the directory is already gone, prune stale git metadata (git worktree prune) so Archon's records match disk","Remove the directory manually with adequate permissions, then re-run cleanup to clear the record","Re-run `archon isolation cleanup` — skipped/locked entries may succeed once the run has finished"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before cleanup, verify the worktree path exists and is unused\nif (!existsSync(env.working_path)) {\n  getLog().warn({ envId: env.id }, 'worktree_path_missing_before_destroy');\n}\nconst { stdout } = Bun.spawnSync(['git', '-C', env.working_path, 'status', '--porcelain']);\nconst busy = stdout.toString().length === 0 && isProcessUsingPath(env.working_path);","typeGuard":"function isFsError(err: unknown): err is NodeJS.ErrnoException {\n  return err instanceof Error && 'code' in err;\n}","tryCatchPattern":"try {\n  await destroyWorktree(env);\n} catch (err) {\n  getLog().warn({ err, envId: env.id, path: env.working_path }, 'worktree_destroy_failed');\n  failed++;\n}","preventionTips":["Close editors/dev servers/agent processes using the worktree before cleanup","Do not delete worktree directories manually; let Archon manage them","Run cleanup after runs have finished, not concurrently","Re-run cleanup and reconcile against `git worktree list`"],"tags":["cli","git-worktree","cleanup","filesystem"],"backgroundTag":"worktree-destroy-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}