Yeachan-Heo/oh-my-codex · warning · Error

stale_team_cleanup_declined:${teamName}:manually_remove_work

Error message

stale_team_cleanup_declined:${teamName}:manually_remove_worktrees_and_state_before_retrying

What it means

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.

Source

Thrown at src/team/runtime.ts:5766

    return;
  }

  const hasDirtyWorktrees = worktreePaths.some((p) => {
    try { return isWorktreeDirty(p); } catch { return false; }
  });

  const summary: StaleTeamSummary = { teamName, worktreePaths, statePath: stateDir, hasDirtyWorktrees };

  if (!confirmFn) {
    throw new Error(
      `stale_team_artifacts:${teamName}:${worktreePaths.length}_worktrees:` +
      'pass_confirmStaleCleanup_or_manually_remove',
    );
  }

  const confirmed = await confirmFn(summary);
  if (!confirmed) {
    throw new Error(
      `stale_team_cleanup_declined:${teamName}:` +
      'manually_remove_worktrees_and_state_before_retrying',
    );
  }

  for (const wtPath of worktreePaths) {
    await removeWorktreeForce(repoRoot, wtPath);
  }
  await cleanupTeamState(teamName, leaderCwd);
}

async function resolveLeaderSessionId(cwd: string, env: NodeJS.ProcessEnv = process.env): Promise<string> {
  const fromEnv = env.OMX_SESSION_ID || env.CODEX_SESSION_ID || env.SESSION_ID;
  if (fromEnv && fromEnv.trim() !== '') return fromEnv.trim();

  const p = teamRuntimeSessionPath(cwd);
  if (!existsSync(p)) return '';
  try {

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Review the StaleTeamSummary — especially hasDirtyWorktrees — and salvage any uncommitted changes
  2. Manually remove the worktrees and state dir (git worktree remove / rm -rf)
  3. Retry the operation once artifacts are cleared
Defensive patterns

Strategy: try-catch

Try / catch

try { await cleanupStaleTeam(...) } catch (e) { if (e.message.startsWith('stale_team_cleanup_declined')) { /* abort gracefully */ } }

Prevention

When it happens

Trigger: The confirmFn callback returned false during stale team cleanup after artifacts were detected.

Common situations: Interactive prompts where the user answers 'no', usually because dirty worktrees with uncommitted work were reported (hasDirtyWorktrees).

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/ef2c503325f29df6. Report an issue: GitHub.