{"record":{"id":"afeb0a679ec496b5","repo":"facebook/docusaurus","slug":"docs-using-disableversioning-true-option-on-a","errorCode":null,"errorMessage":"Docs: using \"disableVersioning: true\" option on a non-versioned site does not make sense.","messagePattern":"Docs: using \"disableVersioning: true\" option on a non-versioned site does not make sense\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/versions/files.ts","lineNumber":143,"sourceCode":" * `includeCurrentVersion` to be true);\n * - If `includeCurrentVersion` is turned on, \"current\" will be inserted at the\n * beginning, if not already there.\n *\n * You need to use {@link filterVersions} after this.\n *\n * @throws Throws an error if `disableVersioning: true` but `versions.json`\n * doesn't exist (i.e. site is not versioned)\n * @throws Throws an error if versions list is empty (empty `versions.json` or\n * `disableVersioning` is true, and not including current version)\n */\nexport async function readVersionNames(\n  siteDir: string,\n  options: PluginOptions,\n): Promise<string[]> {\n  const versionFileContent = await readVersionsFile(siteDir, options.id);\n\n  if (!versionFileContent && options.disableVersioning) {\n    throw new Error(\n      `Docs: using \"disableVersioning: true\" option on a non-versioned site does not make sense.`,\n    );\n  }\n\n  const versions = options.disableVersioning ? [] : (versionFileContent ?? []);\n\n  // We add the current version at the beginning, unless:\n  // - user don't want to; or\n  // - it's already been explicitly added to versions.json\n  if (\n    options.includeCurrentVersion &&\n    !versions.includes(CURRENT_VERSION_NAME)\n  ) {\n    versions.unshift(CURRENT_VERSION_NAME);\n  }\n\n  if (versions.length === 0) {\n    throw new Error(","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/versions/files.ts#L125-L161","documentation":"Thrown by readVersionNames(). The function reads versions.json; if the file does not exist (or is empty) AND the user has set disableVersioning:true, the configuration is contradictory - disabling versioning on a site that is not versioned has no effect - so the build fails fast with an explanatory message.","triggerScenarios":"docusaurus.config.js sets docs.disableVersioning:true on a brand-new site that never ran `docusaurus docs:version` (no versions.json); disabling versioning after deleting versions.json; copying a config from a versioned site to an unversioned one without removing the flag.","commonSituations":"Starter templates that include `disableVersioning: true` by default; config copy-paste between projects; removing versions.json manually but leaving the option on.","solutions":["If you do not need versioning, simply remove `disableVersioning: true` from the docs plugin options (an unversioned site works without it).","If you intend to disable versioning on a previously-versioned site, keep versions.json present (or first run at least one version cut) so the option has something to disable.","Remove the option entirely and rely on the default (versioning off until you cut a version)."],"exampleFix":"// docusaurus.config.js - before\nplugins: [['@docusaurus/plugin-content-docs', {\n  disableVersioning: true, // site has no versions.json\n}]]\n\n// after: drop the option on an unversioned site\nplugins: [['@docusaurus/plugin-content-docs', {}]]","handlingStrategy":"validation","validationCode":"// Validate the docs options combo before passing them to the plugin.\nfunction validateDocsOptions(options, versionsJsonExists) {\n  if (options.disableVersioning && !versionsJsonExists) {\n    throw new Error('disableVersioning:true requires an existing versions.json; remove the option on an unversioned site.');\n  }\n}","typeGuard":"function isUnversionedSite(options, versionsJsonExists) {\n  return !versionsJsonExists && (options.includeCurrentVersion ?? true);\n}","tryCatchPattern":null,"preventionTips":["Do not set disableVersioning on sites that have never cut a version.","On unversioned sites, omit versioning options entirely.","Review copied docusaurus.config.js for options that do not apply to the new project."],"tags":["docs","versioning","configuration"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}