{"record":{"id":"2fb45a1fd0e351d4","repo":"openai/codex-plugin-cc","slug":"expected-a-semver-like-version-such-as-1-0-3-got","errorCode":null,"errorMessage":"Expected a semver-like version such as 1.0.3, got: ${version}","messagePattern":"Expected a semver-like version such as 1\\.0\\.3, got: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/bump-version.mjs","lineNumber":124,"sourceCode":"      i += 1;\n    } else if (arg === \"--help\" || arg === \"-h\") {\n      options.help = true;\n    } else if (arg.startsWith(\"-\")) {\n      throw new Error(`Unknown option: ${arg}`);\n    } else if (options.version) {\n      throw new Error(`Unexpected extra argument: ${arg}`);\n    } else {\n      options.version = arg;\n    }\n  }\n\n  options.root = path.resolve(options.root);\n  return options;\n}\n\nfunction validateVersion(version) {\n  if (!VERSION_PATTERN.test(version)) {\n    throw new Error(`Expected a semver-like version such as 1.0.3, got: ${version}`);\n  }\n}\n\nfunction requireObject(value, label) {\n  if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n    throw new Error(`Expected ${label} to be an object.`);\n  }\n}\n\nfunction findMarketplacePlugin(json) {\n  const plugin = json.plugins?.find((entry) => entry?.name === \"codex\");\n  requireObject(plugin, \".claude-plugin/marketplace.json plugins[codex]\");\n  return plugin;\n}\n\nfunction readJson(root, file) {\n  const filePath = path.join(root, file);\n  return JSON.parse(fs.readFileSync(filePath, \"utf8\"));","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/scripts/bump-version.mjs#L106-L142","documentation":"Thrown by validateVersion() when the supplied version string fails the VERSION_PATTERN regex: ^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(optional prerelease)(optional build). It enforces a semver-like shape with no leading zeros in numeric parts. Prerelease/build suffixes are allowed but the numeric core must be clean.","triggerScenarios":"Passing a version like '1.0', '1.0.0.0', 'v1.0.0', '01.2.3', '1.2', 'latest', or any non-semver string to bump-version.mjs as the positional, or to --check via package.json's version field.","commonSituations":"Adding a 'v' prefix ('v1.0.0'); truncating to major.minor; leading zeros from a zero-padded build number; using a dist-tag like 'next'; copying a non-semver version from another manifest.","solutions":["Pass a full X.Y.Z version: 1.0.3 (optionally with -prerelease or +build suffixes).","Drop any 'v' prefix before the numerics.","Avoid leading zeros in numeric segments (use 1.0.3 not 01.0.3)."],"exampleFix":"// before\n$ node scripts/bump-version.mjs v1.0.3\n\n// after\n$ node scripts/bump-version.mjs 1.0.3","handlingStrategy":"validation","validationCode":"const SEMVER = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nfunction assertSemver(version) {\n  if (!SEMVER.test(version)) {\n    throw new Error(`'${version}' is not a semver X.Y.Z string.`);\n  }\n}\n\nassertSemver(version); // before invoking bump-version","typeGuard":"function isSemverVersion(value) {\n  return typeof value === \"string\" && /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(value);\n}","tryCatchPattern":null,"preventionTips":["Strip a leading 'v' from version strings before passing them in.","Always include all three numeric segments (major.minor.patch).","Reuse the script's own VERSION_PATTERN in callers to validate upfront."],"tags":["validation","semver","bump-version","cli"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}