coleam00/Archon · warning

Error processing codebase: ${err.message}

Error message

  Error processing codebase: ${err.message}

What it means

isolationCleanupMergedCommand prints this per-codebase error line when processing merged worktree cleanup for one codebase throws. The error is logged as 'merged_cleanup_failed' with the codebase id; the loop continues to the next codebase and the summary reports totals without counting per-codebase failures.

Source

Thrown at packages/cli/src/commands/isolation.ts:228

        codebase.codebaseId,
        codebase.defaultCwd,
        options
      );

      for (const branch of result.removed) {
        console.log(`  Cleaned: ${branch}`);
      }
      for (const skip of result.skipped) {
        console.log(`  Skipped: ${skip.branchName} (${skip.reason})`);
      }

      totalCleaned += result.removed.length;
      totalSkipped += result.skipped.length;
    } catch (error) {
      const err = error as Error;
      getLog().warn({ err, codebaseId: codebase.codebaseId }, 'merged_cleanup_failed');
      console.error(`  Error processing codebase: ${err.message}`);
    }
  }

  console.log(
    `\nMerged cleanup complete: ${String(totalCleaned)} cleaned, ${String(totalSkipped)} skipped`
  );
}

/**
 * Complete branch lifecycle — remove worktree, local branch, remote branch, mark DB as destroyed
 */
export async function isolationCompleteCommand(
  branchNames: string[],
  options: { force?: boolean; deleteRemote?: boolean }
): Promise<void> {
  let completed = 0;
  let failed = 0;
  let notFound = 0;

View on GitHub (pinned to 0773b97458)

Solutions

  1. Fix the specific codebase's checkout (restore/repair the path or git metadata) identified by codebaseId in the 'merged_cleanup_failed' log line
  2. Run `git worktree prune` in the affected repo to clear stale worktree records, then re-run cleanup-merged
  3. Verify the branch still exists and has been merged so the tool can classify it
  4. Re-run the command; it skips already-cleaned entries and only retries the failed codebase's worktrees
Defensive patterns

Strategy: try-catch

Validate before calling

// per-codebase pre-check
if (!existsSync(codebase.checkoutPath)) {
  getLog().warn({ codebaseId: codebase.codebaseId }, 'codebase_path_missing_skip_cleanup');
  continue;
}

Try / catch

try {
  const result = await cleanupMergedForCodebase(codebase);
  totalCleaned += result.removed.length;
} catch (err) {
  getLog().warn({ err, codebaseId: codebase.codebaseId }, 'merged_cleanup_failed');
}

Prevention

When it happens

Trigger: Running `archon isolation cleanup-merged` when the merged-branch worktree scan/removal for one codebase throws — git command failure (not a repo, corrupt worktree metadata), working path missing or inaccessible, or DB lookup for that codebase's environments fails.

Common situations: A codebase whose checkout was deleted or moved; a branch whose merge status can't be computed (rebased/deleted remote branch); permission issues on one codebase's path causing only that entry to fail while others clean fine.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/1349a11c609b1e69. Report an issue: GitHub.