{"record":{"id":"36caa6e794ad8773","repo":"vuejs/core","slug":"invalid-target-version-targetversion","errorCode":null,"errorMessage":"invalid target version: ${targetVersion}","messagePattern":"invalid target version: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release.js","lineNumber":185,"sourceCode":"        type: 'input',\n        name: 'version',\n        message: 'Input custom version',\n        initial: currentVersion,\n      })\n      targetVersion = result.version\n    } else {\n      targetVersion = release.match(/\\((.*)\\)/)?.[1] ?? ''\n    }\n  }\n\n  // @ts-expect-error\n  if (versionIncrements.includes(targetVersion)) {\n    // @ts-expect-error\n    targetVersion = inc(targetVersion)\n  }\n\n  if (!semver.valid(targetVersion)) {\n    throw new Error(`invalid target version: ${targetVersion}`)\n  }\n\n  if (skipPrompts) {\n    step(`Releasing v${targetVersion}...`)\n  } else {\n    /** @type {{ yes: boolean }} */\n    const { yes: confirmRelease } = await prompt({\n      type: 'confirm',\n      name: 'yes',\n      message: `Releasing v${targetVersion}. Confirm?`,\n    })\n\n    if (!confirmRelease) {\n      return\n    }\n  }\n\n  await runTestsIfNeeded()","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/vuejs/core/blob/a2b40db9a83b36ed9da3a16403cf8f040262d73f/scripts/release.js#L167-L203","documentation":"Thrown by Vue's release script (scripts/release.js) when the resolved targetVersion fails semver.valid() after increment resolution. The script derives targetVersion from CLI args / a release-type prompt, optionally bumps it via semver.inc, and rejects anything that is not a valid semver. release.js:185 hard-fails before prompting for confirmation.","triggerScenarios":"Running `node scripts/release.js <arg>` with an argument that is neither a release type (major/minor/patch/prepatch/...) nor a valid version; passing a malformed explicit version like `1.2` or `vfoo`; an increment that produced an empty string (the `?? ''` fallback when no `(type)` group is matched).","commonSituations":"Typo in the release-type argument; passing a tag/prerelease string the script cannot parse; invoking the script with no usable argument in a non-interactive (skipPrompts) context.","solutions":["Pass a valid release type: `node scripts/release.js patch` (or minor/major), or a full version like `3.4.0`.","If specifying a prerelease, use the format the script expects (e.g. `beta` with a matching dist-tag).","Run the script without arguments to use the interactive prompt instead of guessing.","Check that the working version in package.json is itself valid semver so inc() can operate."],"exampleFix":"// before\nnode scripts/release.js rel\n// -> invalid target version: rel\n\n// after\nnode scripts/release.js patch","handlingStrategy":"validation","validationCode":"// Validate the release argument before invoking the script.\nconst semver = require('semver')\nconst increments = ['major', 'minor', 'patch', 'prepatch', 'prerelease']\nfunction isValidReleaseArg(arg: string) {\n  return increments.includes(arg) || semver.valid(arg) !== null\n}\nif (!isValidReleaseArg(process.argv[2])) {\n  throw new Error(`Invalid release argument: ${process.argv[2]}. Use major|minor|patch or a semver version.`)\n}","typeGuard":"function isReleaseType(arg: string): boolean {\n  return ['major', 'minor', 'patch', 'prepatch', 'prerelease'].includes(arg) || semver.valid(arg) !== null\n}","tryCatchPattern":null,"preventionTips":["Pass a known release type (major/minor/patch) or a full semver string.","Run the release script interactively (no args) to use the prompt instead of guessing.","Keep package.json's version valid so semver.inc() can operate."],"tags":["vue","release-script","semver","internal-scripts","cli"],"backgroundTag":null,"analyzedSha":"a2b40db9a83b36ed9da3a16403cf8f040262d73f","analyzedAt":"2026-08-12T14:21:14.989Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}