{"record":{"id":"ef2c503325f29df6","repo":"Yeachan-Heo/oh-my-codex","slug":"stale-team-cleanup-declined-teamname-manually-r","errorCode":null,"errorMessage":"stale_team_cleanup_declined:${teamName}:manually_remove_worktrees_and_state_before_retrying","messagePattern":"stale_team_cleanup_declined:(.+?):manually_remove_worktrees_and_state_before_retrying","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/team/runtime.ts","lineNumber":5766,"sourceCode":"    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}\n\nasync function resolveLeaderSessionId(cwd: string, env: NodeJS.ProcessEnv = process.env): Promise<string> {\n  const fromEnv = env.OMX_SESSION_ID || env.CODEX_SESSION_ID || env.SESSION_ID;\n  if (fromEnv && fromEnv.trim() !== '') return fromEnv.trim();\n\n  const p = teamRuntimeSessionPath(cwd);\n  if (!existsSync(p)) return '';\n  try {","sourceCodeStart":5748,"sourceCodeEnd":5784,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L5748-L5784","documentation":"Thrown when the user (via the confirmation callback) declined cleanup of stale team artifacts; nothing was deleted and the message tells you to remove worktrees/state manually before retrying.","triggerScenarios":"The confirmFn callback returned false during stale team cleanup after artifacts were detected.","commonSituations":"Interactive prompts where the user answers 'no', usually because dirty worktrees with uncommitted work were reported (hasDirtyWorktrees).","solutions":["Review the StaleTeamSummary — especially hasDirtyWorktrees — and salvage any uncommitted changes","Manually remove the worktrees and state dir (git worktree remove / rm -rf)","Retry the operation once artifacts are cleared"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await cleanupStaleTeam(...) } catch (e) { if (e.message.startsWith('stale_team_cleanup_declined')) { /* abort gracefully */ } }","preventionTips":["Save dirty worktree changes before confirming cleanup","Communicate consequences to users in the confirm prompt"],"tags":["team","cleanup","user-declined","worktree"],"backgroundTag":"destructive-operation-declined","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}