{"record":{"id":"61ea8fc04f68a991","repo":"facebook/docusaurus","slug":"the-docs-folder-does-not-exist-for-version-vers","errorCode":null,"errorMessage":"The docs folder does not exist for version \"${versionName}\". A docs folder is expected to be found at ${path.relative(context.siteDir, contentPath)}.","messagePattern":"The docs folder does not exist for version \"(.+?)\"\\. A docs folder is expected to be found at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/versions/files.ts","lineNumber":211,"sourceCode":"\n  const shouldTranslate = getLocaleConfig(context.i18n).translate;\n  const contentPathLocalized = shouldTranslate\n    ? getDocsDirPathLocalized({\n        localizationDir: context.localizationDir,\n        pluginId: options.id,\n        versionName,\n      })\n    : undefined;\n\n  const contentPath = isCurrent\n    ? path.resolve(context.siteDir, options.path)\n    : getVersionDocsDirPath(context.siteDir, options.id, versionName);\n  const sidebarFilePath = isCurrent\n    ? options.sidebarPath\n    : getVersionSidebarsPath(context.siteDir, options.id, versionName);\n\n  if (!(await fs.pathExists(contentPath))) {\n    throw new Error(\n      `The docs folder does not exist for version \"${versionName}\". A docs folder is expected to be found at ${path.relative(\n        context.siteDir,\n        contentPath,\n      )}.`,\n    );\n  }\n\n  // If the current version defines a path to a sidebar file that does not\n  // exist, we throw! Note: for versioned sidebars, the file may not exist (as\n  // we prefer to not create it rather than to create an empty file)\n  // See https://github.com/facebook/docusaurus/issues/3366\n  // See https://github.com/facebook/docusaurus/pull/4775\n  if (\n    versionName === CURRENT_VERSION_NAME &&\n    typeof sidebarFilePath === 'string' &&\n    !(await fs.pathExists(sidebarFilePath))\n  ) {\n    throw new Error(`The path to the sidebar file does not exist at \"${path.relative(","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/versions/files.ts#L193-L229","documentation":"Thrown by getVersionMetadataPaths(). For each version, the plugin resolves a docs content directory (either siteDir/options.path for the current version, or getVersionDocsDirPath for a versioned one) and checks it with fs.pathExists. If the folder is missing the build fails, naming the version and the relative path where the folder was expected.","triggerScenarios":"A versioned_docs/version-<name>/ directory was deleted or never created; versions.json lists a version whose versioned_docs folder does not exist; options.path points at a non-existent directory for the current version; partial git checkout missing the versioned_docs subtree.","commonSituations":"Deleting a version's docs folder without removing it from versions.json; renaming options.path; misconfigured monorepo where the docs path is relative to the wrong siteDir; CI cache missing versioned docs.","solutions":["Create the missing directory shown in the error and add at least one Markdown/MDX file to it.","If the version is obsolete, remove its entry from versions.json and delete its versioned_docs / versioned_sidebars folders.","For the current version, ensure options.path (default 'docs') resolves to an existing folder under siteDir.","Re-run `docusaurus docs:version <name>` to (re)generate the versioned_docs folder from current."],"exampleFix":"# error: version '1.4' expects versioned_docs/version-1.4/\n\n# fix: create the folder and add a doc\nmkdir -p versioned_docs/version-1.4\necho '# Welcome' > versioned_docs/version-1.4/intro.md\n\n# or remove the version if obsolete\n# edit versions.json to drop '1.4', then:\nrm -rf versioned_docs/version-1.4 versioned_sidebars/version-1.4-sidebars.json","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\n// Ensure every version in versions.json has a docs folder.\nfunction ensureVersionDocsFoldersExist(siteDir, pluginId, versionNames) {\n  const current = path.join(siteDir, 'docs');\n  if (!fs.existsSync(current)) throw new Error(`Current docs folder missing: ${current}`);\n  for (const v of versionNames) {\n    const dir = path.join(siteDir, 'versioned_docs', `version-${v}`);\n    if (!fs.existsSync(dir)) throw new Error(`Missing docs folder for version ${v}: ${dir}`);\n  }\n}","typeGuard":"function versionDocsFolderExists(siteDir, versionName) {\n  const dir = versionName === 'current'\n    ? path.join(siteDir, 'docs')\n    : path.join(siteDir, 'versioned_docs', `version-${versionName}`);\n  return fs.existsSync(dir);\n}","tryCatchPattern":null,"preventionTips":["When removing a version, delete both the versions.json entry and the versioned_docs folder.","Keep versioned_docs/ in version control and CI.","Verify options.path points at an existing directory."],"tags":["docs","versioning","filesystem","configuration"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}