{"record":{"id":"e7577a33f6a27c33","repo":"Yeachan-Heo/oh-my-codex","slug":"stale-team-artifacts-teamname-worktreepaths-l","errorCode":null,"errorMessage":"stale_team_artifacts:${teamName}:${worktreePaths.length}_worktrees:pass_confirmStaleCleanup_or_manually_remove","messagePattern":"stale_team_artifacts:(.+?):(.+?)_worktrees:pass_confirmStaleCleanup_or_manually_remove","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/team/runtime.ts","lineNumber":5758,"sourceCode":"  const worktreePaths: string[] = [];\n  for (let i = 1; i <= workerCount; i++) {\n    const wtPath = join(repoRoot, '.omx', 'team', teamName, 'worktrees', `worker-${i}`);\n    if (existsSync(wtPath)) worktreePaths.push(wtPath);\n  }\n\n  if (worktreePaths.length === 0) {\n    await cleanupTeamState(teamName, leaderCwd);\n    return;\n  }\n\n  const hasDirtyWorktrees = worktreePaths.some((p) => {\n    try { return isWorktreeDirty(p); } catch { return false; }\n  });\n\n  const summary: StaleTeamSummary = { teamName, worktreePaths, statePath: stateDir, hasDirtyWorktrees };\n\n  if (!confirmFn) {\n    throw new Error(\n      `stale_team_artifacts:${teamName}:${worktreePaths.length}_worktrees:` +\n      'pass_confirmStaleCleanup_or_manually_remove',\n    );\n  }\n\n  const confirmed = await confirmFn(summary);\n  if (!confirmed) {\n    throw new Error(\n      `stale_team_cleanup_declined:${teamName}:` +\n      'manually_remove_worktrees_and_state_before_retrying',\n    );\n  }\n\n  for (const wtPath of worktreePaths) {\n    await removeWorktreeForce(repoRoot, wtPath);\n  }\n  await cleanupTeamState(teamName, leaderCwd);\n}","sourceCodeStart":5740,"sourceCodeEnd":5776,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L5740-L5776","documentation":"Thrown during stale team cleanup when stale worktree artifacts are found but no confirmation callback was supplied; the API refuses to destructively delete worktrees without user confirmation.","triggerScenarios":"Invoking stale-team cleanup for a team with leftover worktree paths while omitting the confirmStaleCleanup callback parameter.","commonSituations":"Scripts calling cleanup programmatically without wiring an interactive confirmation; leftover worktrees after a crashed team run.","solutions":["Pass a confirmFn/confirmStaleCleanup callback to the cleanup API","Or manually remove the listed worktrees and the team state dir, then retry"],"exampleFix":"// before\ncleanupStaleTeam({ teamName, cwd });\n// after\ncleanupStaleTeam({ teamName, cwd, confirmStaleCleanup: async (summary) => true });","handlingStrategy":"validation","validationCode":"const hasArtifacts = worktreePaths.length > 0; if (hasArtifacts && !confirmFn) { /* supply callback or clean manually */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a confirm callback in scripts that may encounter stale teams","Inspect StaleTeamSummary.hasDirtyWorktrees before approving deletion"],"tags":["team","cleanup","confirmation","worktree"],"backgroundTag":"destructive-operation-unconfirmed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}