{"record":{"id":"b370a41762df8c6c","repo":"facebook/docusaurus","slug":"invalid-version-name-name-version-name-must","errorCode":null,"errorMessage":"Invalid version name \"${name}\": version name must contain at least one non-whitespace character.","messagePattern":"Invalid version name \"(.+?)\": version name must contain at least one non-whitespace character\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-content-docs/src/versions/validation.ts","lineNumber":20,"sourceCode":" * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport _ from 'lodash';\nimport type {VersionsOptions} from '@docusaurus/plugin-content-docs';\n\nexport function validateVersionName(name: unknown): asserts name is string {\n  if (typeof name !== 'string') {\n    throw new Error(\n      `Versions should be strings. Found type \"${typeof name}\" for version ${JSON.stringify(\n        name,\n      )}.`,\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  });","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-content-docs/src/versions/validation.ts#L2-L38","documentation":"Thrown by validateVersionName() after the type check passes. If the (string) name trims to an empty string, the build fails because a version name must contain at least one non-whitespace character. This is the second of three sequential checks.","triggerScenarios":"versions.json contains \"\" or \"   \" (spaces/tabs only) as a version entry; a trailing comma produced an empty element; copy-paste left a blank slot; programmatic generation wrote an empty string placeholder.","commonSituations":"Editing versions.json and leaving a stray empty entry; templating that emits blank values; whitespace-only values from misformatted YAML/JSON.","solutions":["Remove the empty/whitespace entry from versions.json.","Replace it with a real version name like \"1.4\".","Sanitize generated versions.json by filtering out names that do not trim to a non-empty string."],"exampleFix":"// versions.json - before\n[\"1.4\", \"   \", \"1.3\"]\n\n// after\n[\"1.4\", \"1.3\"]","handlingStrategy":"validation","validationCode":"function rejectBlankVersionNames(names) {\n  names.forEach((name, i) => {\n    if (typeof name === 'string' && !name.trim()) {\n      throw new Error(`versions.json[${i}] is blank/whitespace-only`);\n    }\n  });\n}","typeGuard":"function isNonBlankString(name) {\n  return typeof name === 'string' && name.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Filter out empty strings when generating versions.json: names.filter((n) => n.trim()).","Avoid trailing commas in hand-edited JSON.","Validate the file before committing."],"tags":["docs","versioning","configuration","validation"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}