{"record":{"id":"3d40d79401db0669","repo":"facebook/docusaurus","slug":"couldn-t-read-the-list-of-git-submodules-failure-w","errorCode":null,"errorMessage":"Couldn't read the list of git submodules\nFailure while running ${logger.code('git submodule status')} from cwd=${logger.path(cwd)}\nThe command executed throws an error: ${error.message}","messagePattern":"Couldn't read the list of git submodules\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":368,"sourceCode":"    return fs.realpath.native(output);\n  }\n  return getGitRepoRoot(cwd);\n}\n\n// See https://git-scm.com/book/en/v2/Git-Tools-Submodules\nexport async function getGitSubmodulePaths(cwd: string): Promise<string[]> {\n  const createErrorMessageBase = () => {\n    return `Couldn't read the list of git submodules\nFailure while running ${logger.code(\n      'git submodule status',\n    )} from cwd=${logger.path(cwd)}`;\n  };\n\n  const result = await execa('git', ['submodule', 'status'], {\n    cwd,\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\n  if (!output) {","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-utils/src/vcs/gitUtils.ts#L350-L386","documentation":"The spawn-rejection branch of getGitSubmodulePaths: `git submodule status` could not be launched or rejected (cwd invalid, git missing, EPERM). Cause is chained. Called from getGitAllRepoRoots after a superproject root was already located.","triggerScenarios":"getGitSubmodulePaths(superProjectRoot) invoked with an invalid/deleted path, or git binary removed between the rev-parse and submodule calls.","commonSituations":"Race where the repo dir is removed mid-build, restricted CI sandbox that revokes git after the first call, or PATH manipulation between steps.","solutions":["Confirm superProjectRoot still exists at call time.","Ensure git stays available on PATH for the whole build.","Re-run from a stable checkout."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await getGitSubmodulePaths(root);\n} catch (e) {\n  if (/git submodule status/.test(String(e))) handleSpawnFailure(e);\n  else throw e;\n}","preventionTips":["Keep cwd valid for the whole build (do not delete it mid-run).","Lock git onto PATH for the entire build pipeline.","Avoid concurrent operations that remove the repo dir."],"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"}