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

scale_down_cleanup_debt_path_missing_parent:${path}

Error message

scale_down_cleanup_debt_path_missing_parent:${path}

What it means

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.

Source

Thrown at src/team/scaling.ts:1547

export function isSameOrInsidePath(
  path: string,
  root: string,
  pathSemantics: PathContainmentSemantics = { relative, isAbsolute, sep },
): boolean {
  const relativePath = pathSemantics.relative(root, path);
  return relativePath === ''
    || (!pathSemantics.isAbsolute(relativePath)
      && relativePath !== '..'
      && !relativePath.startsWith(`..${pathSemantics.sep}`));
}

async function assertExistingPathParentContained(path: string, root: string): Promise<void> {
  const canonicalRoot = await realpath(root);
  let candidate = resolve(path);
  while (!existsSync(candidate)) {
    const parent = dirname(candidate);
    if (parent === candidate) throw new Error(`scale_down_cleanup_debt_path_missing_parent:${path}`);
    candidate = parent;
  }
  const canonicalExistingPath = await realpath(candidate);
  if (!isSameOrInsidePath(canonicalExistingPath, canonicalRoot)) {
    throw new Error(`scale_down_cleanup_debt_path_escape:${path}`);
  }
}

async function validateScaleDownCleanupResources(
  teamName: string,
  leaderCwd: string,
  teamStateRoot: string,
  workers: readonly ScaleDownCleanupDebtResource[],
): Promise<void> {
  const canonicalLeaderCwd = await realpath(leaderCwd);
  let repoRoot = canonicalLeaderCwd;
  const repoRootResult = spawnSync('git', ['rev-parse', '--show-toplevel'], {
    cwd: leaderCwd,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Verify the storage volume containing the team state root is mounted and accessible
  2. Remount or restore the missing ancestor directory, then retry scale-down
  3. Recreate/repair team config worker metadata pointing at nonexistent roots
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
import { dirname } from 'node:path';
function hasExistingAncestor(p: string): boolean {
  let c = p;
  while (!existsSync(c)) { const parent = dirname(c); if (parent === c) return false; c = parent; }
  return true;
}

Try / catch

catch (e) {
  if ((e as Error).message.startsWith('scale_down_cleanup_debt_path_missing_parent')) {
    // volume likely unmounted: remount and retry
    throw new Error('storage volume unavailable; remount and retry scale-down');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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