{"record":{"id":"6a483c9b5902597d","repo":"facebook/docusaurus","slug":"couldn-t-find-the-git-superproject-root-directory","errorCode":null,"errorMessage":"Couldn't find the git superproject root directory\nFailure while running ${logger.code('git rev-parse --show-superproject-working-tree')} from cwd=${logger.path(cwd)}\nThe command executed throws an error: ${error.message}","messagePattern":"Couldn't find the git superproject root directory\nFailure while running (.+?) from cwd=(.+?)\nThe command executed throws an error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus-utils/src/vcs/gitUtils.ts","lineNumber":330,"sourceCode":"export async function getGitSuperProjectRoot(\n  cwd: string,\n): Promise<string | null> {\n  const createErrorMessageBase = () => {\n    return `Couldn't find the git superproject root directory\nFailure while running ${logger.code(\n      'git rev-parse --show-superproject-working-tree',\n    )} from cwd=${logger.path(cwd)}`;\n  };\n\n  const result = await execa(\n    'git',\n    ['rev-parse', '--show-superproject-working-tree'],\n    {\n      cwd,\n    },\n  ).catch((error) => {\n    // We enter this rejection when cwd is not a dir for example\n    throw new Error(\n      `${createErrorMessageBase()}\nThe command executed throws an error: ${error.message}`,\n      {cause: error},\n    );\n  });\n\n  if (result.exitCode !== 0) {\n    throw new Error(\n      `${createErrorMessageBase()}\nThe command returned exit code ${logger.code(result.exitCode)}: ${logger.subdue(\n        result.stderr,\n      )}`,\n    );\n  }\n\n  const output = result.stdout.trim();\n  // this command only works when inside submodules\n  // otherwise it doesn't return anything when we are inside the main repo","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-utils/src/vcs/gitUtils.ts#L312-L348","documentation":"Sibling of error 100 for getGitSuperProjectRoot: the execa call for `git rev-parse --show-superproject-working-tree` rejects before returning (invalid cwd, git missing, spawn failure). The cause is chained. This helper is only meaningfully called when submodules may be present.","triggerScenarios":"getGitAllRepoRoots(cwd) running while cwd is invalid or git cannot be spawned; the superproject probe fails at the process level.","commonSituations":"Container/CI images without git, deleted cwd, or running a submodule-aware build in an environment where the git binary is sandboxed away.","solutions":["Confirm `git rev-parse --show-superproject-working-tree` can be spawned at all (git installed, cwd valid).","Ensure Docusaurus is launched from an existing directory.","If submodules are irrelevant, ensure getGitAllRepoRoots is not invoked from a broken context."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await getGitAllRepoRoots(cwd);\n} catch (e) {\n  const cause = (e as Error).cause as Error | undefined;\n  if (cause && /show-superproject-working-tree/.test(cause.message)) {\n    // superproject probe failed at spawn — check git/cwd\n  }\n}","preventionTips":["Keep git available on PATH for the entire build.","Validate cwd liveness before invoking submodule-aware code.","Isolate the superproject probe so a failure can degrade gracefully."],"tags":["git","vcs","submodule","spawn"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}