{"record":{"id":"3e787f1f5639c825","repo":"affaan-m/ECC","slug":"unknown-argument-arg-3e787f","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/harness-adapter-compliance.js","lineNumber":56,"sourceCode":"    }\n\n    if (arg.startsWith('--format=')) {\n      parsed.format = arg.slice('--format='.length).toLowerCase();\n      continue;\n    }\n\n    if (arg === '--root') {\n      parsed.root = path.resolve(args[index + 1] || process.cwd());\n      index += 1;\n      continue;\n    }\n\n    if (arg.startsWith('--root=')) {\n      parsed.root = path.resolve(arg.slice('--root='.length));\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  parsed.root = path.resolve(parsed.root);\n  return parsed;\n}\n\nfunction printHelp() {\n  console.log([\n    'Usage: node scripts/harness-adapter-compliance.js [options]',\n    '',\n    'Validate or render the ECC harness adapter compliance scorecard.',\n    '',\n    'Options:',\n    '  --check                 Fail if adapter records or docs are out of sync',","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/harness-adapter-compliance.js#L38-L74","documentation":"Thrown by the argument parser in scripts/harness-adapter-compliance.js when a dash-prefixed argument is not one of the recognized flags (--format, --json, --markdown, --text, --root, --help, -h) or their --flag=value variants. Any unrecognized token starting with '--' reaches the final throw.","triggerScenarios":"Passing an unsupported flag like `--verbose`, `--output report.txt`, or a typo'd flag name such as `--forma` instead of `--format`.","commonSituations":"Typo in flag name, using flags from a different script, or passing a flag that was renamed in a version update.","solutions":["Run `node scripts/harness-adapter-compliance.js --help` to see accepted flags.","Check for typos in flag names.","Remove the unrecognized flag.","Use --format=value or --root=value syntax if applicable."],"exampleFix":"// before\nnode scripts/harness-adapter-compliance.js --outformat json\n// after\nnode scripts/harness-adapter-compliance.js --format json","handlingStrategy":"validation","validationCode":"const VALID_FLAGS = new Set(['--format', '--json', '--markdown', '--text', '--root', '--help', '-h']);\nconst unknown = args.filter(a => a.startsWith('--') && !VALID_FLAGS.has(a.split('=')[0]));\nif (unknown.length > 0) {\n  console.error(`Unknown flag(s): ${unknown.join(', ')}`);\n  process.exit(1);\n}","typeGuard":"function isKnownHarnessFlag(arg) {\n  const base = arg.split('=')[0];\n  return ['--format', '--json', '--markdown', '--text', '--root', '--help', '-h'].includes(base);\n}","tryCatchPattern":null,"preventionTips":["Run --help to see accepted flags before constructing commands.","Validate flags in wrapper scripts.","Watch for typos and abbreviations that are not supported."],"tags":["cli","argument-parsing","harness","user-input"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}