affaan-m/ECC · error · Error

Multiple ECC repo roots detected

Error message

Multiple ECC repo roots detected: ${uniqueRepoRoots.join(', ')}

What it means

runAutoUpdate infers the ECC repo root(s) from the environment. If no repo root was explicitly requested and inference finds more than one distinct root, it throws instead of guessing which repo to update, because updating the wrong checkout could corrupt unrelated installs.

Solutions

  1. Pass the repo root explicitly via the CLI flag/option so inference is skipped
  2. Remove or rename the duplicate ECC checkout(s) listed in the error
  3. Run auto-update from inside one specific ECC repo directory
  4. Audit for symlinked or stale install paths producing extra inferred roots

Example fix

// before
node scripts/auto-update.js
// Error: Multiple ECC repo roots detected: /home/me/ECC, /home/me/tools/ECC
// after
node scripts/auto-update.js --repo-root /home/me/ECC
Defensive patterns

Strategy: validation

Validate before calling

const roots = collectInferredRepoRoots();
if (new Set(roots).size > 1 && !process.env.ECC_REPO_ROOT) {
  throw new Error(`Multiple repo roots: ${[...new Set(roots)].join(', ')}; set ECC_REPO_ROOT`);
}

Try / catch

try {
  await runAutoUpdate({});
} catch (err) {
  if (String(err.message).startsWith('Multiple ECC repo roots')) {
    return runAutoUpdate({ requestedRepoRoot: process.cwd() });
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling runAutoUpdate without a requestedRepoRoot option while the inference logic collects two or more unique repo roots (e.g. running the script from a directory nested between multiple ECC checkouts or multiple detected install paths).

Common situations: A developer has cloned ECC twice (dev copy and installed copy) and runs auto-update from a shared parent; CI caches place multiple repo copies on disk; symlinked installs causing multiple resolved roots.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/ee43430f6ff3687f. Report an issue: GitHub.

Appendix: source

Thrown at scripts/auto-update.js:247

        installStatePath: record.installStatePath,
        status: 'error',
        error: record.error || 'No valid install-state available'
      });
      continue;
    }

    const recordRepoRoot = requestedRepoRoot || validateRepoRoot(deriveRepoRootFromState(record.state));
    inferredRepoRoots.push(recordRepoRoot);
    validRecords.push({
      record,
      repoRoot: recordRepoRoot
    });
  }

  if (!requestedRepoRoot) {
    const uniqueRepoRoots = [...new Set(inferredRepoRoots)];
    if (uniqueRepoRoots.length > 1) {
      throw new Error(`Multiple ECC repo roots detected: ${uniqueRepoRoots.join(', ')}`);
    }
  }

  const repoRoot = requestedRepoRoot || inferredRepoRoots[0] || null;
  if (!repoRoot) {
    return {
      dryRun: Boolean(options.dryRun),
      repoRoot,
      results,
      warnings,
      summary: {
        checkedCount: results.length,
        updatedCount: 0,
        errorCount: results.length
      }
    };
  }

View on GitHub (pinned to 8321021c54)