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

stale_team_artifacts:${teamName}:${worktreePaths.length}_wor

Error message

stale_team_artifacts:${teamName}:${worktreePaths.length}_worktrees:pass_confirmStaleCleanup_or_manually_remove

What it means

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.

Source

Thrown at src/team/runtime.ts:5758

  const worktreePaths: string[] = [];
  for (let i = 1; i <= workerCount; i++) {
    const wtPath = join(repoRoot, '.omx', 'team', teamName, 'worktrees', `worker-${i}`);
    if (existsSync(wtPath)) worktreePaths.push(wtPath);
  }

  if (worktreePaths.length === 0) {
    await cleanupTeamState(teamName, leaderCwd);
    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);
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Pass a confirmFn/confirmStaleCleanup callback to the cleanup API
  2. Or manually remove the listed worktrees and the team state dir, then retry

Example fix

// before
cleanupStaleTeam({ teamName, cwd });
// after
cleanupStaleTeam({ teamName, cwd, confirmStaleCleanup: async (summary) => true });
Defensive patterns

Strategy: validation

Validate before calling

const hasArtifacts = worktreePaths.length > 0; if (hasArtifacts && !confirmFn) { /* supply callback or clean manually */ }

Prevention

When it happens

Trigger: Invoking stale-team cleanup for a team with leftover worktree paths while omitting the confirmStaleCleanup callback parameter.

Common situations: Scripts calling cleanup programmatically without wiring an interactive confirmation; leftover worktrees after a crashed team run.

Related errors


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