affaan-m/ECC · error · Error

Unknown argument

Error message

Unknown argument

What it means

Thrown by scripts/welcome.js parseArgs for any argv token that is not --action or --version. The welcome script has an extremely small surface (only those two flags plus their values), so any other token — including --help, -h, positional arguments, or flags valid in other ECC scripts — is rejected. There is no help flag implemented in this script.

Source

Thrown at scripts/welcome.js:39

  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)) {
  try {
    const { action, version } = parseArgs(argv);
    const color = process.env.NO_COLOR === undefined
      && process.env.TERM !== 'dumb'
      && Boolean(process.stdout.isTTY);

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Remember welcome.js only accepts --action <value> and --version <value>; remove any other token.
  2. If you tried to pass the action positionally, use the flag form: `--action installed`.
  3. Do not expect --help here; consult the ECC install hook documentation for valid welcome invocations.

Example fix

// before
node scripts/welcome.js installed

// after
node scripts/welcome.js --action installed
Defensive patterns

Strategy: validation

Validate before calling

// welcome.js only accepts --action and --version
function validateWelcomeArgs(argv) {
  for (let i = 0; i < argv.length; i++) {
    const tok = argv[i];
    if (tok !== '--action' && tok !== '--version' && tok.startsWith('-')) {
      throw new Error(`welcome.js does not accept: ${tok}`);
    }
    if (tok === '--action' || tok === '--version') i += 1; // skip value
  }
}

Prevention

When it happens

Trigger: Passing `node scripts/welcome.js --help` (not supported here), `node scripts/welcome.js installed` (positional, not flagged), or `node scripts/welcome.js --color`.

Common situations: Assuming welcome.js supports --help like other ECC scripts (it does not); passing the action as a bare positional instead of via --action; copying flags from status.js or uninstall.js into a welcome invocation.

Related errors


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