{"record":{"id":"052fecf802eca3b8","repo":"affaan-m/ECC","slug":"unknown-argument-arg-052fec","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/uninstall.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('Uninstall 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/uninstall.js#L21-L57","documentation":"Thrown by scripts/uninstall.js parseArgs when an argv token is not one of the recognized flags: --target, --dry-run, --json, --help, or -h. The uninstall parser is a strict allowlist and rejects any unknown option before consulting install-state files, preventing accidental removal triggered by a misunderstood flag.","triggerScenarios":"Passing `node scripts/uninstall.js --force`, `--all`, `--purge`, or any flag not in the four-flag allowlist. Also triggered by flags from an older/newer ECC version whose uninstall surface differs.","commonSituations":"Users assuming uninstall supports a --force or --all flag common to other uninstallers; typos like `--dryrun` (correct is --dry-run); passing a global flag that belongs to a different ECC subcommand.","solutions":["Run `node scripts/uninstall.js --help` to see the accepted flags and the supported --target values.","Correct the flag spelling (note it is --dry-run with a hyphen, not --dryrun).","Remove the unsupported flag or replace it with the closest valid equivalent (--target scopes removal, --dry-run previews)."],"exampleFix":"// before\nnode scripts/uninstall.js --force\n\n// after\nnode scripts/uninstall.js --target claude --dry-run","handlingStrategy":"validation","validationCode":"const UNINSTALL_FLAGS = new Set(['--target', '--dry-run', '--json', '--help', '-h']);\nfunction validateUninstallArgs(argv) {\n  for (let i = 0; i < argv.length; i++) {\n    const tok = argv[i];\n    if (tok.startsWith('-') && !UNINSTALL_FLAGS.has(tok)) {\n      throw new Error(`Unsupported uninstall.js flag: ${tok}`);\n    }\n    if (tok === '--target') i += 1; // skip value\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember uninstall.js only has four real flags; there is no --force or --all.","Use --dry-run first to preview removals before a real run.","Validate --target values against SUPPORTED_INSTALL_TARGETS from lib/install-manifests.js."],"tags":["cli","argument-parsing","uninstall","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}