{"record":{"id":"4e31f22d11b425d7","repo":"affaan-m/ECC","slug":"unknown-argument-arg-4e31f2","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/platform-audit.js","lineNumber":202,"sourceCode":"      continue;\n    }\n\n    if (arg.startsWith('--max-dirty-files=')) {\n      parsed.thresholds.maxDirtyFiles = parseIntegerFlag(arg.slice('--max-dirty-files='.length), '--max-dirty-files');\n      continue;\n    }\n\n    if (arg === '--use-env-github-token') {\n      parsed.useEnvGithubToken = true;\n      continue;\n    }\n\n    if (arg === '--exit-code') {\n      parsed.exitCode = true;\n      continue;\n    }\n\n    throw new Error(`Unknown argument: ${arg}`);\n  }\n\n  if (!['text', 'json', 'markdown'].includes(parsed.format)) {\n    throw new Error(`Invalid format: ${parsed.format}. Use text, json, or markdown.`);\n  }\n\n  if (parsed.writePath && parsed.format === 'text') {\n    throw new Error('--write requires --json, --markdown, or --format json|markdown');\n  }\n\n  parsed.allowUntracked = parsed.allowUntracked.map(normalizeRelativePrefix);\n\n  return parsed;\n}\n\nfunction normalizeRelativePrefix(value) {\n  return String(value || '')\n    .replace(/\\\\/g, '/')","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/platform-audit.js#L184-L220","documentation":"Thrown at the end of platform-audit's parseArgs loop when a token matched no recognized flag. The parser handles --help, --format(+==), --json, --markdown, --root(+==), --repo(+==), --skip-github, --allow-untracked(+==), --write(+==), the three --max-* integer flags(+==), --use-env-github-token, and --exit-code; anything else is rejected outright rather than silently ignored.","triggerScenarios":"A typo like `--jsom` or `--alllow-untracked`; passing a positional repo path instead of `--repo`; using a flag from a newer/older version; an unintended shell expansion injecting a stray token.","commonSituations":"Version drift between the docs the user read and the installed script; copy-pasting flags from a different tool; shell glob expanding to multiple words the parser sees as flags.","solutions":["Run `--help` to list every accepted flag for this installed version.","Quote shell arguments and check glob expansion if a path was intended.","Use the `=` form for value flags to reduce ordering mistakes that masquerade as unknown args."],"exampleFix":"# before\nnode scripts/platform-audit.js --alllow-untracked src/ --repo owner/repo\n# after\nnode scripts/platform-audit.js --allow-untracked src/ --repo owner/repo","handlingStrategy":"validation","validationCode":"const ACCEPTED_PLATFORM_AUDIT_FLAGS = new Set([\n  '--help','-h','--format','--json','--markdown','--root','--repo',\n  '--skip-github','--allow-untracked','--write','--max-open-prs',\n  '--max-open-issues','--max-dirty-files','--use-env-github-token','--exit-code'\n]);\nfunction isAcceptedFlag(token) {\n  const base = token.split('=')[0];\n  return ACCEPTED_PLATFORM_AUDIT_FLAGS.has(base);\n}","typeGuard":"function isKnownPlatformAuditFlag(token) {\n  const base = token.startsWith('--') ? token.split('=')[0] : token;\n  return ACCEPTED_PLATFORM_AUDIT_FLAGS.has(base);\n}","tryCatchPattern":"try {\n  parseArgs(process.argv);\n} catch (err) {\n  if (err.message.startsWith('Unknown argument')) {\n    console.error(`${err.message}. Run --help for the accepted flag list.`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Run --help for the authoritative flag list of the installed version.","Quote path arguments and check shell glob expansion.","Use `--flag=value` form to reduce ordering-related typos."],"tags":["cli","argument-validation","platform-audit"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}