{"record":{"id":"ee43430f6ff3687f","repo":"affaan-m/ECC","slug":"multiple-ecc-repo-roots-detected-uniquereporoot","errorCode":null,"errorMessage":"Multiple ECC repo roots detected: ${uniqueRepoRoots.join(', ')}","messagePattern":"Multiple ECC repo roots detected: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/auto-update.js","lineNumber":247,"sourceCode":"        installStatePath: record.installStatePath,\n        status: 'error',\n        error: record.error || 'No valid install-state available'\n      });\n      continue;\n    }\n\n    const recordRepoRoot = requestedRepoRoot || validateRepoRoot(deriveRepoRootFromState(record.state));\n    inferredRepoRoots.push(recordRepoRoot);\n    validRecords.push({\n      record,\n      repoRoot: recordRepoRoot\n    });\n  }\n\n  if (!requestedRepoRoot) {\n    const uniqueRepoRoots = [...new Set(inferredRepoRoots)];\n    if (uniqueRepoRoots.length > 1) {\n      throw new Error(`Multiple ECC repo roots detected: ${uniqueRepoRoots.join(', ')}`);\n    }\n  }\n\n  const repoRoot = requestedRepoRoot || inferredRepoRoots[0] || null;\n  if (!repoRoot) {\n    return {\n      dryRun: Boolean(options.dryRun),\n      repoRoot,\n      results,\n      warnings,\n      summary: {\n        checkedCount: results.length,\n        updatedCount: 0,\n        errorCount: results.length\n      }\n    };\n  }\n","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/auto-update.js#L229-L265","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Pass the repo root explicitly via the CLI flag/option so inference is skipped","Remove or rename the duplicate ECC checkout(s) listed in the error","Run auto-update from inside one specific ECC repo directory","Audit for symlinked or stale install paths producing extra inferred roots"],"exampleFix":"// before\nnode scripts/auto-update.js\n// Error: Multiple ECC repo roots detected: /home/me/ECC, /home/me/tools/ECC\n// after\nnode scripts/auto-update.js --repo-root /home/me/ECC","handlingStrategy":"validation","validationCode":"const roots = collectInferredRepoRoots();\nif (new Set(roots).size > 1 && !process.env.ECC_REPO_ROOT) {\n  throw new Error(`Multiple repo roots: ${[...new Set(roots)].join(', ')}; set ECC_REPO_ROOT`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runAutoUpdate({});\n} catch (err) {\n  if (String(err.message).startsWith('Multiple ECC repo roots')) {\n    return runAutoUpdate({ requestedRepoRoot: process.cwd() });\n  }\n  throw err;\n}","preventionTips":["Keep only one ECC checkout on the machine, or pass an explicit repo root","Set the repo-root option in scripts/CI instead of relying on inference","Remove stale clones and broken symlinks","Log inferred roots during setup to catch ambiguity early"],"tags":["ambiguity","configuration","repo-root"],"backgroundTag":"conflicting-config-options","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}