{"record":{"id":"c6d5a05eefff354f","repo":"affaan-m/ECC","slug":"invalid-version-value","errorCode":null,"errorMessage":"Invalid --version value","messagePattern":"Invalid --version value","errorType":"validation","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/welcome.js#L29-L65","documentation":"When a --version value is provided, it must match ECC_VERSION_PATTERN (a regex describing accepted ECC version formats). Values that are present but malformed fail this final validation. Note the check only runs when version !== undefined, so omitting --version entirely is fine.","triggerScenarios":"`node scripts/welcome.js --action install --version banana`, or versions with wrong formatting (missing 'v', extra suffixes, '2.2' vs expected pattern) that the ECC_VERSION_PATTERN regex rejects.","commonSituations":"Hand-typed versions with typos; pasting a tag like 'v2.2.1' when the pattern expects bare semver (or vice versa); scripts interpolating branch names or dates instead of versions.","solutions":["Inspect ECC_VERSION_PATTERN in scripts/welcome.js and format the version to match it exactly","Try the canonical current version format (e.g. a semver string matching the pattern)","Omit --version entirely if you don't need to pin one — it is optional","Copy the version string from package.json or the latest release tag, then adjust to the pattern"],"exampleFix":"// before\nnode scripts/welcome.js --action install --version latest\n// after\nnode scripts/welcome.js --action install --version 2.2.1","handlingStrategy":"validation","validationCode":"const version = process.argv[process.argv.indexOf('--version') + 1];\nif (version !== undefined && !ECC_VERSION_PATTERN.test(version)) {\n  throw new Error(`Invalid --version value: ${version}`);\n}","typeGuard":"function isValidEccVersion(value) {\n  return typeof value === 'string' && ECC_VERSION_PATTERN.test(value);\n}","tryCatchPattern":"try {\n  parseArgs(process.argv.slice(2));\n} catch (err) {\n  if (err.message === 'Invalid --version value') {\n    console.error(`Version must match ${ECC_VERSION_PATTERN}`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Read ECC_VERSION_PATTERN in the script and format versions to match","Source version strings from package.json or release tags, not free text","Omit --version when a pinned version isn't required","Sanitize user-supplied versions before passing them through"],"tags":["cli","validation","regex"],"backgroundTag":"invalid-flag-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}