{"record":{"id":"55f0033721a99a6b","repo":"facebook/docusaurus","slug":"this-docusaurus-site-is-outside-any-git-worktree","errorCode":null,"errorMessage":"This Docusaurus site is outside any Git worktree.\nUnable to read Git info for file ${logger.path(filePath)} ","messagePattern":"This Docusaurus site is outside any Git worktree\\.\nUnable to read Git info for file (.+?) ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus-utils/src/vcs/vcsGitEager.ts","lineNumber":91,"sourceCode":"    if (!isInWorktree) {\n      return {type: 'error', reason: 'not-in-worktree'};\n    }\n    const filesMap = await loadAllGitFilesInfoMap(siteDir);\n    return {type: 'success', filesMap};\n  } catch (error) {\n    return {type: 'error', reason: 'unknown', cause: error as Error};\n  }\n}\n\nexport function createVcsGitEagerConfig(): VcsConfig {\n  let initPromise: Promise<InitializeResult> | null = null;\n\n  async function getGitFileInfo(filePath: string): Promise<GitFileInfo | null> {\n    const init = (await initPromise)!;\n    if (init.type === 'success') {\n      return init.filesMap.get(filePath) ?? null;\n    } else if (init.reason === 'not-in-worktree') {\n      throw new Error(\n        `This Docusaurus site is outside any Git worktree.\nUnable to read Git info for file ${logger.path(filePath)} `,\n      );\n    } else {\n      throw init.cause;\n    }\n  }\n\n  return {\n    initialize: ({siteDir}) => {\n      if (initPromise) {\n        // We only initialize this VCS once!\n        // For i18n sites, this permits reading ahead of time for all locales\n        // so that it only slows down the first locale\n        // I assume this logic is fine, but we'll see if it causes trouble\n\n        // Note: we could also only call \"initialize()\" once from the outside,\n        // But maybe it could be useful for custom VCS implementations to be","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-utils/src/vcs/vcsGitEager.ts#L73-L109","documentation":"Thrown by the eager git VCS's getGitFileInfo when initialization reported reason 'not-in-worktree' — i.e. the build is running outside any git worktree, yet a component asked for git metadata (last update author/date) for a specific file. The trailing space in the message is intentional in source. This is the runtime consequence of error 101 happening during init.","triggerScenarios":"Site is built outside a git checkout but theme code or plugins call getGitFileInfo for a markdown/asset file (e.g. to render 'last updated by').","commonSituations":"Unpacked release tarball with no `.git`, vendored docs, Docker image that copied sources without git metadata, or build triggered from /tmp.","solutions":["Build from within the actual git checkout so the worktree is detected.","Disable git-backed last-update/author features, or switch to a non-git VCS preset that does not require a worktree.","Ensure CI clones the repo (`actions/checkout`) rather than copying files."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import {execSync} from 'child_process';\nfunction isInWorktree(cwd: string): boolean {\n  try { execSync('git rev-parse --is-inside-work-tree', {cwd, stdio: 'ignore'}); return true; }\n  catch { return false; }\n}\n// if false, do not enable git-backed last-update/author features","typeGuard":null,"tryCatchPattern":"try {\n  const info = await vcs.getGitFileInfo(filePath);\n} catch (e) {\n  if (/outside any Git worktree/.test(String(e))) return null; // degrade gracefully\n  throw e;\n}","preventionTips":["Build from the real git checkout, not an unpacked tarball.","In Docker, clone the repo inside the image rather than copying sources.","Disable last-update/author features when git metadata is unavailable."],"tags":["git","vcs","worktree","build"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}