{"record":{"id":"3b4f7793b9a84b15","repo":"facebook/docusaurus","slug":"invalid-docs-option-onlyincludeversions-unknown","errorCode":null,"errorMessage":"Invalid docs option \"onlyIncludeVersions\": unknown versions (${unknownOnlyIncludeVersionNames.join(',')}) found. ${availableVersionNamesMsg}","messagePattern":"Invalid docs option \"onlyIncludeVersions\": unknown versions \\((.+?)\\) found\\. (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/versions/validation.ts","lineNumber":100,"sourceCode":"    throw new Error(\n      `Invalid docs option \"versions\": unknown versions (${unknownVersionConfigNames.join(\n        ',',\n      )}) found. ${availableVersionNamesMsg}`,\n    );\n  }\n\n  if (options.onlyIncludeVersions) {\n    if (options.onlyIncludeVersions.length === 0) {\n      throw new Error(\n        `Invalid docs option \"onlyIncludeVersions\": an empty array is not allowed, at least one version is needed.`,\n      );\n    }\n    const unknownOnlyIncludeVersionNames = _.difference(\n      options.onlyIncludeVersions,\n      availableVersionNames,\n    );\n    if (unknownOnlyIncludeVersionNames.length > 0) {\n      throw new Error(\n        `Invalid docs option \"onlyIncludeVersions\": unknown versions (${unknownOnlyIncludeVersionNames.join(\n          ',',\n        )}) found. ${availableVersionNamesMsg}`,\n      );\n    }\n    if (\n      options.lastVersion &&\n      !options.onlyIncludeVersions.includes(options.lastVersion)\n    ) {\n      throw new Error(\n        `Invalid docs option \"lastVersion\": if you use both the \"onlyIncludeVersions\" and \"lastVersion\" options, then \"lastVersion\" must be present in the provided \"onlyIncludeVersions\" array.`,\n      );\n    }\n  }\n}\n","sourceCodeStart":82,"sourceCodeEnd":116,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/versions/validation.ts#L82-L116","documentation":"Thrown by validateVersionsOptions when onlyIncludeVersions contains names that are not available versions (computed via _.difference against availableVersionNames). Every entry must reference a real version that exists in versions.json or as 'current'.","triggerScenarios":"Passing onlyIncludeVersions: ['3.0'] when 3.0 isn't a version; including a typo; referencing a version before running docusaurus docs:version to create it.","commonSituations":"Renaming/removing versions but leaving stale entries in onlyIncludeVersions; copying a config across projects; pre-declaring a future version name that hasn't been cut yet.","solutions":["Match every entry to a name in the error's 'Available version names are:' list.","Create the missing version first with `docusaurus docs:version <name>` if it should exist.","Remove entries for versions you no longer ship."],"exampleFix":"// before\ndocs: { onlyIncludeVersions: ['3.0', '2.0'] } // 3.0 doesn't exist\n// after\ndocs: { onlyIncludeVersions: ['current', '2.0'] }","handlingStrategy":"validation","validationCode":"const available = [...JSON.parse(fs.readFileSync('versions.json','utf8')), 'current'];\nconst unknown = (config.onlyIncludeVersions ?? []).filter(v => !available.includes(v));\nif (unknown.length) throw new Error(`onlyIncludeVersions has unknown: ${unknown.join(', ')}`);","typeGuard":"const allIncludedVersionsExist = (list: string[], available: string[]): boolean =>\n  list.every(v => available.includes(v));","tryCatchPattern":null,"preventionTips":["Generate onlyIncludeVersions from versions.json instead of hardcoding.","Re-validate after version cuts."],"tags":["docs","versioning","config-validation"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}