{"record":{"id":"60be04cdbd6a1a97","repo":"affaan-m/ECC","slug":"unknown-argument-arg-60be04","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/skills-health.js","lineNumber":104,"sourceCode":"\n    if (arg === '--warn-threshold') {\n      options.warnThreshold = Number(requireValue(argv, index, '--warn-threshold'));\n      index += 1;\n      continue;\n    }\n\n    if (arg === '--dashboard') {\n      options.dashboard = true;\n      continue;\n    }\n\n    if (arg === '--panel') {\n      options.panel = requireValue(argv, index, '--panel');\n      index += 1;\n      continue;\n    }\n\n    throw new Error(`Unknown argument: ${arg}`);\n  }\n\n  return options;\n}\n\nfunction main() {\n  try {\n    const options = parseArgs(process.argv.slice(2));\n\n    if (options.help) {\n      showHelp();\n      process.exit(0);\n    }\n\n    if (options.dashboard || options.panel) {\n      const result = renderDashboard(options);\n      process.stdout.write(options.json ? `${JSON.stringify(result.data, null, 2)}\\n` : result.text);\n    } else {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/skills-health.js#L86-L122","documentation":"parseArgs in scripts/skills-health.js iterates argv and only recognizes a fixed set of flags. When it encounters a token it does not match (falling through all known-flag branches), it throws \"Unknown argument: <arg>\". This fail-fast behavior catches typos and unsupported flags instead of ignoring them.","triggerScenarios":"Calling `node scripts/skills-health.js --pannel overview` (typo), or passing a flag like `--verbose` that this script does not implement; any argv token not in the known-flag list reaches the final throw.","commonSituations":"Typos in long flag names; confusing this script's options with another ECC script's; copying a command from docs of a different version where the flag was renamed or removed.","solutions":["Run `node scripts/skills-health.js --help` (or read the script) to list supported flags.","Correct the flag spelling to one of the supported options (e.g. --panel).","Remove the unsupported argument if it was intended for a different script."],"exampleFix":"// before\nnode scripts/skills-health.js --verbose\n// after\nnode scripts/skills-health.js --panel overview","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['--panel', '--json', '--help', '-h']);\nconst unknown = argv.filter(a => a.startsWith('--') && !SUPPORTED.has(a));\nif (unknown.length) console.error('Unsupported flags:', unknown);","typeGuard":null,"tryCatchPattern":"try {\n  runHealthScript(argv);\n} catch (e) {\n  if (e.message.startsWith('Unknown argument')) {\n    console.error(`${e.message}. Run with --help for valid flags.`);\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["Check --help output before adding new flags to scripts or aliases.","Don't reuse command lines across different ECC scripts; each has its own flag set.","Keep shell history/aliases updated when flags are renamed."],"tags":["cli","argument-parsing","unknown-flag"],"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"}