{"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":226,"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      summary: {\n        checkedCount: results.length,\n        updatedCount: 0,\n        errorCount: results.length\n      }\n    };\n  }\n\n  const env = {","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/auto-update.js#L208-L244","documentation":"launch_terminal() resolves the given path with os.path.realpath and refuses to spawn a terminal unless the result is an existing directory (os.path.isdir). This guards against typos, deleted directories, and file (not directory) paths before invoking the platform-specific terminal launcher. The error message reports the canonical resolved path so you can see exactly what was checked.","triggerScenarios":"Passing a file path (not a directory); passing a path to a directory that was deleted; passing a relative path that resolves somewhere unexpected; passing a path whose final component is a symlink to a file.","commonSituations":"A project directory was deleted between detection and the launch call; the caller passed a file path by mistake; a stale cached project root; the path points to a zip/tarball rather than an extracted directory.","solutions":["Verify the directory exists immediately before calling: os.path.isdir(path).","Pass an absolute path to an existing directory.","If the directory may have been removed, re-detect or recreate it before launching."],"exampleFix":"# before\nlaunch_terminal(project_path)  # project_path is a file or deleted\n\n# after\nimport os\ncanonical = os.path.realpath(project_path)\nif not os.path.isdir(canonical):\n    raise SystemExit(f'Cannot open terminal: {canonical} is not a directory')\nlaunch_terminal(canonical)","handlingStrategy":"validation","validationCode":"# Validate the directory exists before launching a terminal.\nimport os\ncanonical = os.path.realpath(path)\nif not os.path.isdir(canonical):\n    raise SystemExit(f'Refusing to open terminal: {canonical!r} is not an existing directory')\nlaunch_terminal(canonical)","typeGuard":"import os\n\ndef is_existing_directory(p) -> bool:\n    return os.path.isdir(os.path.realpath(p))","tryCatchPattern":"try:\n    launch_terminal(project_path)\nexcept ValueError as e:\n    # e.message reports the resolved path that failed the isdir check.\n    log.error('cannot open terminal: %s', e)\n    # re-detect the project root and retry, or surface to user","preventionTips":["Pass absolute paths to launch_terminal to avoid cwd-resolution surprises.","Re-detect the project directory at call time rather than caching it.","Treat a deleted/missing project root as a user-facing error, not a silent skip."],"tags":["filesystem","terminal","validation","directory"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}