{"record":{"id":"67a7fe1aba813f81","repo":"affaan-m/ECC","slug":"unknown-argument-a","errorCode":null,"errorMessage":"Unknown argument: ${a}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/proximity-tick.js","lineNumber":41,"sourceCode":"  const parsed = { watchSec: 0, dryRun: false, json: false, help: false, dbPath: null, stateDbPath: null };\n  for (let i = 0; i < args.length; i += 1) {\n    const a = args[i];\n    if (a === '--help' || a === '-h') parsed.help = true;\n    else if (a === '--dry-run') parsed.dryRun = true;\n    else if (a === '--json') parsed.json = true;\n    else if (a === '--watch') {\n      const v = Number.parseInt(args[i + 1], 10);\n      if (!Number.isInteger(v) || v <= 0) throw new Error('--watch needs a positive seconds value');\n      parsed.watchSec = v;\n      i += 1;\n    } else if (a === '--db') {\n      parsed.dbPath = args[i + 1];\n      i += 1;\n    } else if (a === '--state-db') {\n      parsed.stateDbPath = args[i + 1];\n      i += 1;\n    } else {\n      throw new Error(`Unknown argument: ${a}`);\n    }\n  }\n  return parsed;\n}\n\nfunction showHelp() {\n  console.log(\n    [\n      'Usage: node scripts/proximity-tick.js [--watch <seconds>] [--dry-run] [--json] [--db <path>] [--state-db <path>]',\n      '',\n      'Scan agent proximity from the control-pane state and steer/transmit by sending',\n      'internal session-to-session messages. --dry-run sends nothing; --watch loops.'\n    ].join('\\n')\n  );\n}\n\nfunction report(tick, json) {\n  if (json) {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/proximity-tick.js#L23-L59","documentation":"Thrown by proximity-tick's parseArgs else-branch when a token matched none of --help/-h, --dry-run, --json, --watch, --db, --state-db. The loop is a flat if/else chain with explicit value consumption (i += 1) for the value flags, so any unrecognized token — including a misspelled flag or a value whose flag was typo'd — lands here.","triggerScenarios":"A typo like `--dryrun` (no hyphen) or `--state-db`; a positional arg the script does not accept; a flag from another ECC script; value flags where the previous flag name was misspelled so the value is read as a new flag.","commonSituations":"User copies flags from a different control-pane script; version drift where a flag was renamed; shell expansion turning a path into multiple tokens.","solutions":["Run `--help` to see the five accepted flags (only --watch/--db/--state-db take values).","Use the exact hyphenated forms: `--dry-run`, `--state-db`.","Quote path arguments to --db/--state-db to avoid token splitting."],"exampleFix":"# before\nnode scripts/proximity-tick.js --dryrun --watch 30\n# after\nnode scripts/proximity-tick.js --dry-run --watch 30","handlingStrategy":"validation","validationCode":"const PROXIMITY_FLAGS = new Set(['--help','-h','--dry-run','--json','--watch','--db','--state-db']);\nfunction isProximityFlag(token) {\n  return PROXIMITY_FLAGS.has(token);\n}","typeGuard":"function isKnownProximityFlag(token) {\n  return PROXIMITY_FLAGS.has(token);\n}","tryCatchPattern":"try {\n  parseArgs(process.argv);\n} catch (err) {\n  if (err.message.startsWith('Unknown argument')) {\n    console.error(`${err.message}. Accepted: --dry-run, --json, --watch <s>, --db <path>, --state-db <path>.`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Use exact hyphenated forms: --dry-run, --state-db.","Quote --db/--state-db paths to prevent token splitting.","Run --help to confirm the flag set for this version."],"tags":["cli","argument-validation","proximity-tick"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}