{"record":{"id":"f414d0aec73cc2f0","repo":"affaan-m/ECC","slug":"invalid-ecc-version-installedversion","errorCode":null,"errorMessage":"Invalid ECC version: ${installedVersion}","messagePattern":"Invalid ECC version: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/terminal-welcome.js","lineNumber":98,"sourceCode":"    `Discord:       ${COMMUNITY_LINKS.discord}`,\n    `Documentation: ${COMMUNITY_LINKS.documentation}`,\n    `GitHub App:     ${COMMUNITY_LINKS.githubApp}`,\n  ]);\n  const contentWidth = Math.max(...rows.map(row => row.length));\n  const border = '─'.repeat(contentWidth + 2);\n\n  return [\n    `  ╭${border}╮`,\n    ...rows.map(row => `  │ ${row.padEnd(contentWidth)} │`),\n    `  ╰${border}╯`,\n  ];\n}\n\nfunction renderTerminalWelcome(options = {}) {\n  const color = options.color === true;\n  const installedVersion = options.version || ECC_VERSION;\n  if (!ECC_VERSION_PATTERN.test(installedVersion)) {\n    throw new Error(`Invalid ECC version: ${installedVersion}`);\n  }\n  const graphic = renderWordmark(color);\n  const successMessage = SUCCESS_MESSAGES[options.action] || SUCCESS_MESSAGES.installed;\n  const welcomeMessage = colorize(successMessage, '1;35', color);\n  const version = colorize(`v${installedVersion}`, '2', color);\n  const versionLine = color ? `\\x1b[1G  ${version}` : `  ${version}`;\n\n  return [\n    '',\n    graphic,\n    '',\n    `  ${welcomeMessage}`,\n    versionLine,\n    '',\n    ...renderCommunityLinks(),\n    '',\n  ].join('\\n');\n}","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/terminal-welcome.js#L80-L116","documentation":"Thrown by renderTerminalWelcome() when the supplied or package-derived ECC version does not match ECC_VERSION_PATTERN, a strict semver regex (MAJOR.MINOR.PATCH with optional prerelease and build metadata). The function builds an ANSI-colored banner that includes the version literal, so a malformed value would corrupt the layout or mislead the user. The check runs before any rendering work.","triggerScenarios":"Passing options.version = 'latest', '2.2', 'v2.2.0', '2.2.0-dev', or '' explicitly; a package.json that has been mutated to a non-semver version (e.g. a git describe tag like '2.2.0-14-gabc1234' is allowed only if it matches the prerelease shape); a downstream distribution that rewrote package.json version to a placeholder.","commonSituations":"CI sets package.version to a commit SHA; a fork changes the version scheme; options.version is read from an env var with a typo; a prerelease tag contains disallowed characters (the regex allows [0-9A-Za-z.-] but not spaces or symbols).","solutions":["Use a strict semver string: '2.2.0', '2.2.0-beta.1', '2.2.0+build.4'.","Strip a leading 'v' before passing the value: version.replace(/^v/, '').","If you cannot guarantee semver, omit options.version — the function falls back to ECC_VERSION from package.json, which the maintainers keep semver-compliant.","In a fork, either keep package.json semver-compliant or validate and rewrite the version before calling renderTerminalWelcome."],"exampleFix":"// before\nshowTerminalWelcome({ version: 'v2.2.0' });   // leading v fails the regex\n\n// after\nshowTerminalWelcome({ version: '2.2.0' });\n// or omit version entirely to use package.json ECC_VERSION","handlingStrategy":"validation","validationCode":"const SEMVER = /^[0-9]+(?:\\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nfunction safeVersion(raw) {\n  const v = typeof raw === 'string' ? raw.replace(/^v/i, '') : raw;\n  if (typeof v === 'string' && SEMVER.test(v)) return v;\n  return null;  // or fall back to package.json ECC_VERSION\n}\n\nconst version = safeVersion(process.env.ECC_VERSION);\nshowTerminalWelcome(version ? { version } : {});","typeGuard":"const ECC_VERSION_PATTERN = /^[0-9]+(?:\\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nfunction isSemver(value) {\n  return typeof value === 'string' && ECC_VERSION_PATTERN.test(value);\n}","tryCatchPattern":"try {\n  showTerminalWelcome({ version });\n} catch (error) {\n  if (/Invalid ECC version/.test(error.message)) {\n    // fall back to the package.json version\n    showTerminalWelcome({});\n    return;\n  }\n  throw error;\n}","preventionTips":["Omit options.version unless you have a specific reason to override — the package default is always semver-compliant.","Strip a leading 'v' from any user-supplied version before passing it in.","Validate env-var overrides with the same regex the library uses.","Keep package.json version semver-compliant in forks — non-semver values break this and other tooling."],"tags":["terminal-welcome","semver","validation","versioning"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}