{"record":{"id":"b388de86682fb30d","repo":"affaan-m/ECC","slug":"unknown-argument-arg-b388de","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/repair.js","lineNumber":39,"sourceCode":"    dryRun: false,\n    json: false,\n    help: false,\n  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n\n    if (arg === '--target') {\n      parsed.targets.push(args[index + 1] || null);\n      index += 1;\n    } else if (arg === '--dry-run') {\n      parsed.dryRun = true;\n    } else if (arg === '--json') {\n      parsed.json = true;\n    } else if (arg === '--help' || arg === '-h') {\n      parsed.help = true;\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  return parsed;\n}\n\nfunction printHuman(result) {\n  if (result.results.length === 0) {\n    console.log('No ECC install-state files found for the current home/project context.');\n    return;\n  }\n\n  console.log('Repair summary:\\n');\n  for (const entry of result.results) {\n    console.log(`- ${entry.adapter.id}`);\n    console.log(`  Status: ${entry.status.toUpperCase()}`);\n    console.log(`  Install-state: ${entry.installStatePath}`);\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/repair.js#L21-L57","documentation":"Thrown by repair.js parseArgs when an argument token matches none of the accepted flags: --target <id>, --dry-run, --json, --help/-h. repair has a small fixed surface and rejects anything else rather than silently ignoring it.","triggerScenarios":"Passing a flag like --scope or --fix that belongs to setup.js; a typo such as `--dryrun` (missing hyphen); an unexpected positional argument.","commonSituations":"Confusing repair.js flags with setup.js flags (both are ECC scripts); using long-form variants the parser does not support; stale flags from an older ECC version.","solutions":["Run `node scripts/repair.js --help` to confirm the flag set.","Fix the typo (e.g. `--dry-run` not `--dryrun`).","Repeat --target once per target id rather than comma-separating.","Remove flags that belong to other scripts."],"exampleFix":"# before\nnode scripts/repair.js --targets foo,bar --dryrun\n# after\nnode scripts/repair.js --target foo --target bar --dry-run","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--target', '--dry-run', '--json', '--help', '-h']);\nconst bad = process.argv.slice(2).filter(a => a.startsWith('--') && !ALLOWED.has(a));\nif (bad.length) { console.error('Unknown flag(s) for repair.js:', bad.join(' ')); process.exit(2); }","typeGuard":null,"tryCatchPattern":"try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); }","preventionTips":["Document each script's flag set and lint invocations in CI.","Use shell completion or a wrapper that rejects unknown flags before they reach the parser."],"tags":["cli","argument-parsing","repair"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}