{"record":{"id":"ec3c22b80726e0bf","repo":"thedotmack/claude-mem","slug":"worktree-adoption-failed-for-parent-repo-continui","errorCode":null,"errorMessage":"Worktree adoption failed for parent repo (continuing)","messagePattern":"Worktree adoption failed for parent repo \\(continuing\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/services/infrastructure/WorktreeAdoption.ts","lineNumber":414,"sourceCode":"  } finally {\n    db?.close();\n  }\n\n  if (uniqueParents.size === 0) {\n    logger.debug('SYSTEM', 'Worktree adoption found no known parent repos');\n    return results;\n  }\n\n  for (const repoPath of uniqueParents) {\n    try {\n      const result = await adoptMergedWorktrees({\n        repoPath,\n        dataDirectory,\n        dryRun: opts.dryRun\n      });\n      results.push(result);\n    } catch (err) {\n      logger.warn(\n        'SYSTEM',\n        'Worktree adoption failed for parent repo (continuing)',\n        { repoPath, error: err instanceof Error ? err.message : String(err) }\n      );\n    }\n  }\n\n  return results;\n}\n","sourceCodeStart":396,"sourceCodeEnd":424,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/services/infrastructure/WorktreeAdoption.ts#L396-L424","documentation":"The top-level loop calls adoptMergedWorktrees once per unique parent repository, each in its own try/catch. When one repo's adoption throws before or outside the per-branch handling — git worktree enumeration failing, data directory problems, or the source DB refusing to open — this warning records the repoPath and continues with the remaining repos. The run is a partial success; the failed repo simply has no entry in results.","triggerScenarios":"adoptMergedWorktrees(repoPath, dataDirectory, ...) throws: `git worktree list` fails on that repo (corrupt .git, not a repo), the data directory is unwritable, or the worktree's SQLite DB cannot be opened.","commonSituations":"One repo among several on an unavailable mount or corrupted; mixed clone formats (worktree vs submodule); per-project permission differences; repos with malformed .git files.","solutions":["Identify the failed repo from the logged repoPath — the other repos still processed.","Run `git worktree list` manually in that repo to reproduce the underlying failure.","Fix the repo-specific issue (remount, repair .git, correct permissions) and re-run adoption.","Interpret results as partial success: a repo absent from results is the one that was skipped."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// pre-screen each parent repo so the loop never enters a broken one\nfor (const repoPath of uniqueParents) {\n  const ok = spawnSync('git', ['-C', repoPath, 'worktree', 'list'], { encoding: 'utf8' });\n  if (ok.status !== 0) skipped.push(repoPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  results.push(await adoptMergedWorktrees({ repoPath, dataDirectory }));\n} catch (err) {\n  // one repo failing must not stop the rest — record and continue\n  failedRepos.push({ repoPath, error: String(err) });\n}","preventionTips":["Check `git worktree list` succeeds in every repo before batch adoption.","Mount/permission fixes per repo are cheaper than diagnosing partial results later.","Treat missing entries in results as the failed repos."],"tags":["git-worktree","adoption","partial-failure","resilience"],"backgroundTag":"git-worktree-failed","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","contentChangedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}