{"record":{"id":"99873232291a8853","repo":"affaan-m/ECC","slug":"unknown-argument","errorCode":null,"errorMessage":"Unknown argument","messagePattern":"Unknown argument","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/welcome.js","lineNumber":39,"sourceCode":"\n  for (let index = 0; index < argv.length; index += 1) {\n    const argument = argv[index];\n    if (argument === '--action') {\n      const value = argv[index + 1];\n      if (!value || value.startsWith('--')) {\n        throw new Error('Missing value for --action');\n      }\n      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);","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/welcome.js#L21-L57","documentation":"welcome.js parseArgs implements an allowlist parser: only --action and --version are recognized. Any other argument (including unknown flags, stray positionals, or mistyped variants) hits the final else branch and throws 'Unknown argument'.","triggerScenarios":"Passing any token that is not exactly `--action` or `--version`, e.g. `node scripts/welcome.js --verbose`, `--acton install` (typo), or an unexpected positional word.","commonSituations":"Typos in flag names; flags copied from other ECC scripts (like --target or --json used here by mistake); shell expansion adding unexpected tokens; assuming shared flag conventions across scripts.","solutions":["Remove the unrecognized argument from the command","Check spelling — the parser is exact-match, no abbreviations or aliases","Consult the script header/help to see the only supported flags: --action and --version","If you intended a different script's flag set, run the correct script"],"exampleFix":"// before\nnode scripts/welcome.js --action install --json\n// after\nnode scripts/welcome.js --action install","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--action', '--version']);\nconst unknown = process.argv.slice(2).filter(a => a.startsWith('--') && !ALLOWED.has(a));\nif (unknown.length > 0) throw new Error(`Unknown argument(s): ${unknown.join(', ')}`);","typeGuard":"function isKnownFlag(arg) {\n  return arg === '--action' || arg === '--version';\n}","tryCatchPattern":"try {\n  parseArgs(process.argv.slice(2));\n} catch (err) {\n  if (err.message === 'Unknown argument') {\n    console.error('Only --action and --version are supported. Check spelling and script choice.');\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Cross-check flags against the target script's help before reusing commands from other scripts","Avoid abbreviations — the parser is exact-match","Keep per-script command snippets in separate shell aliases to avoid flag bleed","Version-control your wrapper scripts so flag drift is reviewable"],"tags":["cli","arguments","allowlist"],"backgroundTag":"invalid-cli-argument","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"}