{"record":{"id":"d61b06d71faad5f8","repo":"Yeachan-Heo/oh-my-codex","slug":"scale-down-cleanup-debt-path-missing-parent-path","errorCode":null,"errorMessage":"scale_down_cleanup_debt_path_missing_parent:${path}","messagePattern":"scale_down_cleanup_debt_path_missing_parent:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/scaling.ts","lineNumber":1547,"sourceCode":"\nexport function isSameOrInsidePath(\n  path: string,\n  root: string,\n  pathSemantics: PathContainmentSemantics = { relative, isAbsolute, sep },\n): boolean {\n  const relativePath = pathSemantics.relative(root, path);\n  return relativePath === ''\n    || (!pathSemantics.isAbsolute(relativePath)\n      && relativePath !== '..'\n      && !relativePath.startsWith(`..${pathSemantics.sep}`));\n}\n\nasync function assertExistingPathParentContained(path: string, root: string): Promise<void> {\n  const canonicalRoot = await realpath(root);\n  let candidate = resolve(path);\n  while (!existsSync(candidate)) {\n    const parent = dirname(candidate);\n    if (parent === candidate) throw new Error(`scale_down_cleanup_debt_path_missing_parent:${path}`);\n    candidate = parent;\n  }\n  const canonicalExistingPath = await realpath(candidate);\n  if (!isSameOrInsidePath(canonicalExistingPath, canonicalRoot)) {\n    throw new Error(`scale_down_cleanup_debt_path_escape:${path}`);\n  }\n}\n\nasync function validateScaleDownCleanupResources(\n  teamName: string,\n  leaderCwd: string,\n  teamStateRoot: string,\n  workers: readonly ScaleDownCleanupDebtResource[],\n): Promise<void> {\n  const canonicalLeaderCwd = await realpath(leaderCwd);\n  let repoRoot = canonicalLeaderCwd;\n  const repoRootResult = spawnSync('git', ['rev-parse', '--show-toplevel'], {\n    cwd: leaderCwd,","sourceCodeStart":1529,"sourceCodeEnd":1565,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/scaling.ts#L1529-L1565","documentation":"Thrown by assertExistingPathParentContained while walking up from a path to find an existing ancestor: it reached the filesystem root without finding any existing parent directory. The message embeds the offending path.","triggerScenarios":"scale-down cleanup validation calls assertExistingPathParentContained with a path whose entire ancestor chain up to '/' does not exist (e.g. unmounted drive, deleted root, or malformed path).","commonSituations":"Team state root on an unmounted external drive/network volume; path recorded in worker metadata referencing a volume that no longer exists; broken symlinks making realpath ancestors vanish.","solutions":["Verify the storage volume containing the team state root is mounted and accessible","Remount or restore the missing ancestor directory, then retry scale-down","Recreate/repair team config worker metadata pointing at nonexistent roots"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { dirname } from 'node:path';\nfunction hasExistingAncestor(p: string): boolean {\n  let c = p;\n  while (!existsSync(c)) { const parent = dirname(c); if (parent === c) return false; c = parent; }\n  return true;\n}","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if ((e as Error).message.startsWith('scale_down_cleanup_debt_path_missing_parent')) {\n    // volume likely unmounted: remount and retry\n    throw new Error('storage volume unavailable; remount and retry scale-down');\n  }\n  throw e;\n}","preventionTips":["Keep team state on reliable always-mounted storage","Validate recorded paths exist before initiating scale-down"],"tags":["team","scale-down","filesystem","path-validation"],"backgroundTag":"path-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}