affaan-m/ECC · error · Error

Missing value for --version

Error message

Missing value for --version

What it means

Thrown by scripts/welcome.js parseArgs when --version is passed but the next argv token is missing or starts with '--'. The same guard as --action (`!value || value.startsWith('--')`) prevents consuming the next flag as the version string. --version annotates the welcome banner with the installed ECC version and must be a complete value.

Source

Thrown at scripts/welcome.js:34

]);

function parseArgs(argv) {
  let action = 'installed';
  let version;

  for (let index = 0; index < argv.length; index += 1) {
    const argument = argv[index];
    if (argument === '--action') {
      const value = argv[index + 1];
      if (!value || value.startsWith('--')) {
        throw new Error('Missing value for --action');
      }
      action = value;
      index += 1;
    } else if (argument === '--version') {
      const value = argv[index + 1];
      if (!value || value.startsWith('--')) {
        throw new Error('Missing value for --version');
      }
      version = value;
      index += 1;
    } else {
      throw new Error('Unknown argument');
    }
  }

  if (!VALID_ACTIONS.has(action)) {
    throw new Error('Invalid --action value');
  }
  if (version !== undefined && !ECC_VERSION_PATTERN.test(version)) {
    throw new Error('Invalid --version value');
  }
  return { action, version };
}

function main(argv = process.argv.slice(2)) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Supply a semver-style version after --version: `node scripts/welcome.js --version 2.2.0`.
  2. If you do not need to show a version, omit the flag entirely.
  3. Ensure the wrapper interpolates a real version string (must match X.Y.Z, optionally with - prerelease or + build metadata).

Example fix

// before
node scripts/welcome.js --version

// after
node scripts/welcome.js --version 2.2.0
Defensive patterns

Strategy: validation

Validate before calling

const ECC_VERSION_PATTERN = /^[0-9]+(?:\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
const rawVersion = process.env.ECC_VERSION;
const version = rawVersion ? rawVersion.replace(/^v/, '') : null; // strip leading 'v'
const args = [];
if (version && ECC_VERSION_PATTERN.test(version)) {
  args.push('--version', version);
}

Type guard

function isValidEccVersion(value) {
  const cleaned = String(value).replace(/^v/, '');
  return /^[0-9]+(?:\.[0-9]+){2}(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(cleaned);
}

Prevention

When it happens

Trigger: `node scripts/welcome.js --version` (last token); `node scripts/welcome.js --action installed --version` (--version last); `--version --action installed` (next token is a flag).

Common situations: An install hook passing `--version $VERSION` where $VERSION is unset for a dev/local build; truncating a command while editing; a packaging script that only sets the version variable on tagged builds.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/ec27d523fa48c863. Report an issue: GitHub.