{"record":{"id":"99873232291a8853","repo":"affaan-m/ECC","slug":"unknown-argument","errorCode":null,"errorMessage":"Unknown argument","messagePattern":"Unknown argument","errorType":"exception","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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/welcome.js#L21-L57","documentation":"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.","triggerScenarios":"Passing `node scripts/welcome.js --help` (not supported here), `node scripts/welcome.js installed` (positional, not flagged), or `node scripts/welcome.js --color`.","commonSituations":"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.","solutions":["Remember welcome.js only accepts --action <value> and --version <value>; remove any other token.","If you tried to pass the action positionally, use the flag form: `--action installed`.","Do not expect --help here; consult the ECC install hook documentation for valid welcome invocations."],"exampleFix":"// before\nnode scripts/welcome.js installed\n\n// after\nnode scripts/welcome.js --action installed","handlingStrategy":"validation","validationCode":"// welcome.js only accepts --action and --version\nfunction validateWelcomeArgs(argv) {\n  for (let i = 0; i < argv.length; i++) {\n    const tok = argv[i];\n    if (tok !== '--action' && tok !== '--version' && tok.startsWith('-')) {\n      throw new Error(`welcome.js does not accept: ${tok}`);\n    }\n    if (tok === '--action' || tok === '--version') i += 1; // skip value\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not pass --help to welcome.js (it is not implemented there).","Pass the action via --action <value>, never as a bare positional.","Keep the welcome.js invocation in one place in the install hook to avoid drift."],"tags":["cli","argument-parsing","welcome","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}