{"record":{"id":"be7fc03b12122167","repo":"facebook/docusaurus","slug":"invalid-version-name-name-version-name-mes","errorCode":null,"errorMessage":"Invalid version name \"${name}\": version name ${message}.","messagePattern":"Invalid version name \"(.+?)\": version name (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/versions/validation.ts","lineNumber":34,"sourceCode":"      )}.`,\n    );\n  }\n  if (!name.trim()) {\n    throw new Error(\n      `Invalid version name \"${name}\": version name must contain at least one non-whitespace character.`,\n    );\n  }\n  const errors: [RegExp, string][] = [\n    [/[/\\\\]/, 'should not include slash (/) or backslash (\\\\)'],\n    [/.{33,}/, 'cannot be longer than 32 characters'],\n    // eslint-disable-next-line no-control-regex\n    [/[<>:\"|?*\\x00-\\x1F]/, 'should be a valid file path'],\n    [/^\\.\\.?$/, 'should not be \".\" or \"..\"'],\n  ];\n\n  errors.forEach(([pattern, message]) => {\n    if (pattern.test(name)) {\n      throw new Error(\n        `Invalid version name \"${name}\": version name ${message}.`,\n      );\n    }\n  });\n}\n\nexport function validateVersionNames(\n  names: unknown,\n): asserts names is string[] {\n  if (!Array.isArray(names)) {\n    throw new Error(\n      `The versions file should contain an array of version names! Found content: ${JSON.stringify(\n        names,\n      )}`,\n    );\n  }\n\n  names.forEach(validateVersionName);","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/versions/validation.ts#L16-L52","documentation":"Thrown by validateVersionName() during the regex rule loop. After type and non-empty checks, the name is tested against four patterns: forward/backslash (/ \\), length >= 33 chars, characters invalid in file paths (< > : \" | ? * and control chars 0x00-0x1F), and the literal names '.' or '..'. If any matches, the build fails naming which rule was violated. Version names become directory names under versioned_docs/, so they must be path-safe.","triggerScenarios":"A version name with a slash like '1.4/beta'; a name longer than 32 characters; a name containing characters illegal on Windows (<>:\"|?*); a name that is exactly '.' or '..'; control characters pasted from a clipboard.","commonSituations":"Using semantic version ranges as names ('>=1.4'); very long pre-release labels; cross-platform path issues from special chars; accidental '.' or '..' from relative path confusion.","solutions":["Use a short, simple, path-safe version string like '1.4' or '1.4.0-beta'.","Remove any slash, backslash, or the characters <>:\"|?*.","Trim the name to 32 characters or fewer.","Avoid '.' and '..' as version names."],"exampleFix":"// versions.json - before\n[\"1.4/beta\", \"release-2024-01-01-super-long-pre-release-label\"]\n\n// after: path-safe, short\n[\"1.4-beta\", \"2024-01-01\"]","handlingStrategy":"validation","validationCode":"const RULES = [\n  {re: /[/\\\\]/, msg: 'no slash or backslash'},\n  {re: /.{33,}/, msg: 'max 32 chars'},\n  {re: /[<>:\"|?*\\x00-\\x1F]/, msg: 'no invalid path chars'},\n  {re: /^\\.\\.?$/, msg: 'not . or ..'},\n];\nfunction validateVersionNameRules(name) {\n  for (const {re, msg} of RULES) {\n    if (re.test(name)) throw new Error(`Version name '${name}' invalid: ${msg}`);\n  }\n}","typeGuard":"function isPathSafeVersionName(name) {\n  return typeof name === 'string' &&\n    name.trim().length > 0 &&\n    name.length <= 32 &&\n    !/[/\\\\<>:\"|?*\\x00-\\x1F]/.test(name) &&\n    name !== '.' && name !== '..';\n}","tryCatchPattern":null,"preventionTips":["Use short, simple version strings (digits, dots, hyphens).","Avoid OS-reserved characters that break directory creation cross-platform.","Cap version names at 32 characters."],"tags":["docs","versioning","configuration","validation","filesystem"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}