{"record":{"id":"1349a11c609b1e69","repo":"coleam00/Archon","slug":"error-processing-codebase-err-message","errorCode":null,"errorMessage":"  Error processing codebase: ${err.message}","messagePattern":"  Error processing codebase: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/isolation.ts","lineNumber":228,"sourceCode":"        codebase.codebaseId,\n        codebase.defaultCwd,\n        options\n      );\n\n      for (const branch of result.removed) {\n        console.log(`  Cleaned: ${branch}`);\n      }\n      for (const skip of result.skipped) {\n        console.log(`  Skipped: ${skip.branchName} (${skip.reason})`);\n      }\n\n      totalCleaned += result.removed.length;\n      totalSkipped += result.skipped.length;\n    } catch (error) {\n      const err = error as Error;\n      getLog().warn({ err, codebaseId: codebase.codebaseId }, 'merged_cleanup_failed');\n      console.error(`  Error processing codebase: ${err.message}`);\n    }\n  }\n\n  console.log(\n    `\\nMerged cleanup complete: ${String(totalCleaned)} cleaned, ${String(totalSkipped)} skipped`\n  );\n}\n\n/**\n * Complete branch lifecycle — remove worktree, local branch, remote branch, mark DB as destroyed\n */\nexport async function isolationCompleteCommand(\n  branchNames: string[],\n  options: { force?: boolean; deleteRemote?: boolean }\n): Promise<void> {\n  let completed = 0;\n  let failed = 0;\n  let notFound = 0;\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/isolation.ts#L210-L246","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the specific codebase's checkout (restore/repair the path or git metadata) identified by codebaseId in the 'merged_cleanup_failed' log line","Run `git worktree prune` in the affected repo to clear stale worktree records, then re-run cleanup-merged","Verify the branch still exists and has been merged so the tool can classify it","Re-run the command; it skips already-cleaned entries and only retries the failed codebase's worktrees"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// per-codebase pre-check\nif (!existsSync(codebase.checkoutPath)) {\n  getLog().warn({ codebaseId: codebase.codebaseId }, 'codebase_path_missing_skip_cleanup');\n  continue;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await cleanupMergedForCodebase(codebase);\n  totalCleaned += result.removed.length;\n} catch (err) {\n  getLog().warn({ err, codebaseId: codebase.codebaseId }, 'merged_cleanup_failed');\n}","preventionTips":["Keep codebase checkouts on stable, mounted volumes","Prune stale worktree metadata (`git worktree prune`) before batch cleanup","Ensure branches are actually merged/deleted so classification succeeds","Fix failing codebases individually and re-run; the batch is resumable"],"tags":["cli","git-worktree","cleanup","batch-operation"],"backgroundTag":"worktree-destroy-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}