{"record":{"id":"052fecf802eca3b8","repo":"affaan-m/ECC","slug":"unknown-argument-arg-052fec","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/uninstall.js","lineNumber":51,"sourceCode":"    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 === '--legacy-codex-sync') {\n      parsed.legacyCodexSync = 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  // Dry-run output must be phrased as a preview so it can never be mistaken\n  // for a completed uninstall (#2952).\n  console.log(`Uninstall summary${result.dryRun ? ' (dry run; nothing was removed)' : ''}:\\n`);\n  for (const entry of result.results) {\n    console.log(`- ${entry.adapter.id}`);\n    const statusLabel = result.dryRun && entry.status === 'planned'","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/uninstall.js#L33-L69","documentation":"parseArgs in scripts/uninstall.js accepts a fixed set of flags (e.g. --json, --legacy-codex-sync, --help/-h) and throws \"Unknown argument: <arg>\" for any token that matches none of them. Because uninstall is destructive, strict flag validation prevents unintended or mistyped options from being silently ignored.","triggerScenarios":"Running `node scripts/uninstall.js --dryrun` (typo, if --dry-run is the supported spelling) or passing flags from other scripts like --markdown to uninstall.js.","commonSituations":"Typos on a destructive command; carrying flags over from skills-health.js or status.js command lines; outdated shell history entries after the script's flag set changed.","solutions":["Run `node scripts/uninstall.js --help` to list accepted flags.","Correct the typo to the supported spelling (watch hyphen placement, e.g. --legacy-codex-sync).","Remove flags that belong to other scripts before running uninstall."],"exampleFix":"// before\nnode scripts/uninstall.js --dryrun\n// after\nnode scripts/uninstall.js --help   # then use a supported flag, e.g. --json","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['--json', '--legacy-codex-sync', '--help', '-h']);\nconst unknown = process.argv.slice(2).filter(a => a.startsWith('--') && !SUPPORTED.has(a));\nif (unknown.length) console.error('Unsupported flags for uninstall:', unknown);","typeGuard":null,"tryCatchPattern":"try {\n  runUninstall(argv);\n} catch (e) {\n  if (e.message.startsWith('Unknown argument')) {\n    console.error(`${e.message}. Run 'node scripts/uninstall.js --help' before destructive operations.`);\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["Always verify flags with --help before running an uninstall command.","Watch hyphenation: --legacy-codex-sync, not --legacyCodexSync or --codex-sync.","Keep uninstall invocations in reviewed scripts rather than ad-hoc shell history."],"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"}