{"record":{"id":"c6d5a05eefff354f","repo":"affaan-m/ECC","slug":"invalid-version-value","errorCode":null,"errorMessage":"Invalid --version value","messagePattern":"Invalid --version value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/welcome.js","lineNumber":47,"sourceCode":"      action = value;\n      index += 1;\n    } else if (argument === '--version') {\n      const value = argv[index + 1];\n      if (!value || value.startsWith('--')) {\n        throw new Error('Missing value for --version');\n      }\n      version = value;\n      index += 1;\n    } else {\n      throw new Error('Unknown argument');\n    }\n  }\n\n  if (!VALID_ACTIONS.has(action)) {\n    throw new Error('Invalid --action value');\n  }\n  if (version !== undefined && !ECC_VERSION_PATTERN.test(version)) {\n    throw new Error('Invalid --version value');\n  }\n  return { action, version };\n}\n\nfunction main(argv = process.argv.slice(2)) {\n  try {\n    const { action, version } = parseArgs(argv);\n    const color = process.env.NO_COLOR === undefined\n      && process.env.TERM !== 'dumb'\n      && Boolean(process.stdout.isTTY);\n    process.stdout.write(renderTerminalWelcome({ action, color, version }));\n  } catch (error) {\n    process.stderr.write(`Error: ${error.message}\\n`);\n    process.exitCode = 1;\n  }\n}\n\nif (require.main === module) {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/welcome.js#L29-L65","documentation":"Thrown by scripts/welcome.js when --version is supplied but its value does not match the ECC_VERSION_PATTERN regex `^[0-9]+(?:\\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$`. This requires a full major.minor.patch triplet (e.g. 2.2.0), optionally followed by a hyphen prerelease or plus build metadata. Short forms like '2.2' or 'v2.2.0' (with a leading v) are rejected.","triggerScenarios":"`node scripts/welcome.js --version 2.2` (only two segments); `--version v2.2.0` (leading 'v'); `--version latest` (non-numeric); `--version 2.2.0.0` (four segments — still passes the numeric pattern actually, since the regex allows 2.2.0.0 as major.minor.patch then a trailing group; re-examining: the pattern is `[0-9]+(?:\\.[0-9]+){2}` which matches exactly three numeric groups, so 2.2.0.0 would fail).","commonSituations":"A build pipeline that derives the version from a git tag like 'v2.2.0' without stripping the leading 'v'; package.json scripts passing a two-part version; human-typed shorthand versions.","solutions":["Supply a full three-part version without a leading 'v': `--version 2.2.0`.","Strip a leading 'v' from git-tag-derived versions before passing them to welcome.js.","If using a prerelease or build tag, follow semver: `--version 2.2.0-beta.1` or `--version 2.2.0+sha.abc123`."],"exampleFix":"// before\nnode scripts/welcome.js --version v2.2.0\n\n// after\nnode scripts/welcome.js --version 2.2.0","handlingStrategy":"type-guard","validationCode":"const ECC_VERSION_PATTERN = /^[0-9]+(?:\\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\nfunction normalizeEccVersion(raw) {\n  if (!raw) return null;\n  const v = String(raw).replace(/^v/, '');\n  if (!ECC_VERSION_PATTERN.test(v)) {\n    throw new Error(`Invalid ECC version: ${raw}. Expected X.Y.Z (optionally with - prerelease or + build).`);\n  }\n  return v;\n}","typeGuard":"function isValidEccVersion(value) {\n  const cleaned = String(value).replace(/^v/, '');\n  return /^[0-9]+(?:\\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(cleaned);\n}","tryCatchPattern":null,"preventionTips":["Always strip a leading 'v' from versions before passing to welcome.js.","Read the version from package.json (which is already X.Y.Z) rather than from a git tag.","Add a unit test for the regex against sample good/bad versions."],"tags":["cli","argument-parsing","welcome","version","regex","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}