{"record":{"id":"67a7fe1aba813f81","repo":"affaan-m/ECC","slug":"unknown-argument-a","errorCode":null,"errorMessage":"Unknown argument: ${a}","messagePattern":"Unknown argument: (.+?)","errorType":"validation","errorClass":null,"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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/proximity-tick.js#L23-L59","documentation":"parseArgs in scripts/proximity-tick.js throws this error when a command-line token does not match any of its recognized flags (--help, --dry-run, --json, --watch, --db, --state-db, etc.). The allowlist parser rejects unknown flags instead of ignoring them, catching typos and cross-script flag mistakes.","triggerScenarios":"Passing an unsupported or misspelled flag such as `--interval`, `--verbose`, `--db=` (equals form if unsupported), or a stray positional argument.","commonSituations":"Reusing flags from other tick/audit scripts; typos like `--state_db`; passing positional file paths the script doesn't accept; assuming equals-style syntax is supported.","solutions":["Run with --help/-h to see supported flags","Fix the flag spelling to one of the recognized options","Remove unsupported positional arguments","Use space-separated flag values (e.g. --db path) if equals form isn't supported"],"exampleFix":"// before\nnode scripts/proximity-tick.js --interval 10\n// after\nnode scripts/proximity-tick.js --watch 10","handlingStrategy":"validation","validationCode":"const KNOWN = new Set(['--help','-h','--dry-run','--json','--watch','--db','--state-db']);\nfunction findUnknownFlags(argv) {\n  return argv.slice(2).filter(a => a.startsWith('--') && !KNOWN.has(a));\n}","typeGuard":null,"tryCatchPattern":"try {\n  await main(process.argv);\n} catch (e) {\n  if (e.message.startsWith('Unknown argument:')) {\n    console.error(`${e.message} — see --help for supported flags`);\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Run with --help/-h to confirm flag names before use","Avoid porting flags from sibling scripts without checking","Use space-separated values for --db/--state-db/--watch","Add a dry parse of argv in wrapper scripts to catch typos early"],"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"}