{"record":{"id":"5845eba8312dbe5b","repo":"facebook/docusaurus","slug":"could-not-get-all-the-git-repository-root-paths-s","errorCode":null,"errorMessage":"Could not get all the git repository root paths (superproject + submodules) from cwd=${cwd}","messagePattern":"Could not get all the git repository root paths \\(superproject \\+ submodules\\) from cwd=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus-utils/src/vcs/gitUtils.ts","lineNumber":422,"sourceCode":"  return Promise.all(output.split('\\n').map(getSubmodulePath));\n}\n\n// Find the root git repository alongside all its submodules, if any\nexport async function getGitAllRepoRoots(cwd: string): Promise<string[]> {\n  try {\n    const superProjectRoot = await getGitSuperProjectRoot(cwd);\n    if (!superProjectRoot) {\n      return [];\n    }\n    let submodulePaths = await getGitSubmodulePaths(superProjectRoot);\n    submodulePaths = await Promise.all(\n      submodulePaths.map((submodulePath) =>\n        fs.realpath.native(path.resolve(superProjectRoot, submodulePath)),\n      ),\n    );\n    return [superProjectRoot, ...submodulePaths];\n  } catch (error) {\n    throw new Error(\n      `Could not get all the git repository root paths (superproject + submodules) from cwd=${cwd}`,\n      {cause: error},\n    );\n  }\n}\n\n// Useful information about a file tracked in a Git repository\nexport type GitFileInfo = {\n  creation: GitCommitInfo;\n  lastUpdate: GitCommitInfo;\n};\n\n// A map of all the files tracked in a Git repository\nexport type GitFileInfoMap = Map<string, GitFileInfo>;\n\n// Logic inspired from Astro Starlight:\n// See https://bsky.app/profile/bluwy.me/post/3lyihod6qos2a\n// See https://github.com/withastro/starlight/blob/c417f1efd463be63b7230617d72b120caed098cd/packages/starlight/utils/git.ts#L58","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-utils/src/vcs/gitUtils.ts#L404-L440","documentation":"Top-level catch in getGitAllRepoRoots: any failure from getGitSuperProjectRoot or getGitSubmodulePaths (errors 102-106) is wrapped with a generic 'Could not get all the git repository root paths' message and the original error chained as cause. This is the user-facing aggregate; look at error.cause for the real reason.","triggerScenarios":"Any of errors 102-106 firing during enumeration of superproject + submodule roots.","commonSituations":"Broken submodule state, missing git, deleted cwd, or a corrupted worktree surfaced during VCS initialization.","solutions":["Inspect error.cause to identify which underlying failure (102-106) actually fired, then apply that error's fix.","Repair the git worktree state (submodules init, valid cwd, git on PATH).","Re-run from a clean checkout of the superproject."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const roots = await getGitAllRepoRoots(cwd);\n} catch (e) {\n  const cause = (e as Error).cause as Error | undefined;\n  // dispatch on cause.message to handle 102-106 specifically\n  logVcsInitFailure(cause ?? e);\n}","preventionTips":["Always inspect error.cause for the real underlying git failure.","Keep the whole worktree (superproject + submodules) healthy before building.","Run a preflight: `git rev-parse`, `git submodule status` from the build cwd."],"tags":["git","vcs","wrapper","submodule"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}