{"record":{"id":"dc7f3afbbd960e7c","repo":"Egonex-AI/Understand-Anything","slug":"unknown-option-arg-dc7f3a","errorCode":null,"errorMessage":"Unknown option: ${arg}","messagePattern":"Unknown option: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"understand-anything-plugin/skills/understand/prepare-incremental.mjs","lineNumber":463,"sourceCode":"      && !removedNodeIds.has(edge.target)\n      && !(edge.type === 'imports' && refreshedImportSourceIds.has(edge.source))\n      && retainedIds.has(edge.source)\n      && retainedIds.has(edge.target),\n  );\n  return { nodes, edges };\n}\n\nfunction parseArgs(argv) {\n  const positionals = [];\n  const excludePatterns = [];\n  for (let i = 0; i < argv.length; i++) {\n    const arg = argv[i];\n    if (arg === '--exclude') {\n      const value = argv[++i];\n      if (!value || value.startsWith('--')) throw new Error('--exclude requires patterns');\n      excludePatterns.push(...value.split(',').map(item => item.trim()).filter(Boolean));\n    } else if (arg.startsWith('--')) {\n      throw new Error(`Unknown option: ${arg}`);\n    } else {\n      positionals.push(arg);\n    }\n  }\n  if (positionals.length !== 2) {\n    throw new Error(\n      'Usage: node prepare-incremental.mjs <projectRoot> <baseCommit> [--exclude <patterns>]',\n    );\n  }\n  return { projectRoot: positionals[0], baseCommit: positionals[1], excludePatterns };\n}\n\nasync function main() {\n  const args = parseArgs(process.argv.slice(2));\n  const projectRoot = realpathSync(args.projectRoot);\n  const uaDir = resolveUaDir(projectRoot);\n  const intermediateDir = join(uaDir, 'intermediate');\n  mkdirSync(intermediateDir, { recursive: true });","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/07edf82a04371b6f69779b067bdc8a1a8753a9db/understand-anything-plugin/skills/understand/prepare-incremental.mjs#L445-L481","documentation":"Generic command-line validation guard in parseArgs, thrown as the fall-through branch when an argument does not match any recognized option ('--exclude') and is not consumed as a positional. It fires when the script `node prepare-incremental.mjs <projectRoot> <baseCommit>` is invoked with an unsupported flag — e.g. a typo like '--exlude' or an option the parser does not implement. The faulty input is the unrecognized argv element interpolated into the message. Valid usage is exactly two positionals plus optionally '--exclude <patterns>' with comma-separated patterns.","triggerScenarios":"Invoking prepare-incremental.mjs with an unsupported flag such as --verbose, --dry-run, a misspelled --exlude, or any option not implemented by the script.","commonSituations":"Copy-pasting flags from another script in the /understand skill, typos in flag names, or assuming options supported by the main skill are also supported by this helper script.","solutions":["Remove the unsupported flag; the script accepts only <projectRoot> <baseCommit> and --exclude <patterns>","Fix typos, e.g. --exlude → --exclude","Check the usage message: node prepare-incremental.mjs <projectRoot> <baseCommit> [--exclude <patterns>]","If you need a new option, add it to parseArgs in prepare-incremental.mjs"],"exampleFix":"// before\nnode prepare-incremental.mjs . HEAD --exlude dist\n// after\nnode prepare-incremental.mjs . HEAD --exclude dist","handlingStrategy":"validation","validationCode":"const allowed = new Set(['--exclude']);\nconst bad = process.argv.slice(2).filter(a => a.startsWith('--') && !allowed.has(a));\nif (bad.length) console.error(`Unsupported flags: ${bad.join(' ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  const parsed = parseArgs(argv);\n} catch (err) {\n  if (err.message.startsWith('Unknown option')) {\n    console.error(`${err.message}\\nUsage: node prepare-incremental.mjs <projectRoot> <baseCommit> [--exclude <patterns>]`);\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Check the usage line before adding flags; only --exclude is supported","Beware typos (--exlude, --excldue) — the parser rejects anything unrecognized","Do not copy flags from other scripts in the /understand skill family"],"tags":["cli","arguments"],"backgroundTag":"invalid-cli-argument","analyzedSha":"07edf82a04371b6f69779b067bdc8a1a8753a9db","analyzedAt":"2026-09-07T23:20:10.829Z","contentChangedAt":"2026-09-07T23:20:10.829Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}