{"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":"Error","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/terminal-welcome.js#L80-L116","documentation":"renderTerminalWelcome renders the CLI welcome banner and validates that the version string matches ECC_VERSION_PATTERN before printing. It throws when options.version (or the fallback ECC_VERSION) does not look like a valid ECC version string. This prevents displaying a corrupted or missing version in the terminal UI.","triggerScenarios":"Calling renderTerminalWelcome({ version: 'abc' }) or showTerminalWelcome({ version: '' }); passing a semver with an unexpected format (e.g. a leading 'v' or build metadata the pattern disallows); calling main/welcome with a version sourced from an unparsed file.","commonSituations":"Piping an env var or build artifact into version; a fork/patched build whose version string deviates from the official pattern; JSON output accidentally passed instead of a plain string.","solutions":["Pass a version string matching the ECC pattern (e.g. '2.2.1') in options.version.","Omit options.version so the built-in ECC_VERSION constant is used.","Strip prefixes/suffixes (like a leading 'v' or build metadata) from the version before passing it.","Verify where options.version originates (package.json, env) and fix the upstream producer."],"exampleFix":"// before\nrenderTerminalWelcome({ version: 'v2.2.1' });\n// after\nrenderTerminalWelcome({ version: '2.2.1' });","handlingStrategy":"validation","validationCode":"const ECC_VERSION_PATTERN = /^\\d+\\.\\d+\\.\\d+.*$/; // mirror of library pattern\nif (!ECC_VERSION_PATTERN.test(version)) throw new Error(`Bad version: ${version}`);","typeGuard":"const isValidVersion = (v) => typeof v === 'string' && /^\\d+\\.\\d+\\.\\d+.*$/.test(v);","tryCatchPattern":"try {\n  renderTerminalWelcome({ version });\n} catch (e) {\n  if (String(e.message).startsWith('Invalid ECC version')) {\n    console.error(`Version string not accepted: ${version}; using default`);\n    renderTerminalWelcome();\n  } else throw e;\n}","preventionTips":["Never prefix the version with 'v' before passing it.","Omit options.version and let the library use its own constant.","Normalize version strings at the config/env boundary.","Test banner rendering with the exact version your build emits."],"tags":["cli","validation","version"],"backgroundTag":"invalid-argument-format","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"}