{"record":{"id":"241172578a7f9687","repo":"tinyhumansai/openhuman","slug":"unknown-option-arg-241172","errorCode":null,"errorMessage":"unknown option: ${arg}","messagePattern":"unknown option: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/harness-cache-audit.mjs","lineNumber":129,"sourceCode":"        break;\n      case \"--min-hit-rate\":\n        opts.minHitRate = parseNonNegativeNumber(next(), \"--min-hit-rate\");\n        break;\n      case \"--max-turns-without-cache\":\n        opts.maxTurnsWithoutCache = parseNonNegativeInt(\n          next(),\n          \"--max-turns-without-cache\",\n        );\n        break;\n      case \"--verbose\":\n        opts.verbose = true;\n        break;\n      case \"-h\":\n      case \"--help\":\n        console.log(usage());\n        process.exit(0);\n      default:\n        throw new Error(`unknown option: ${arg}`);\n    }\n  }\n  return opts;\n}\n\nfunction parsePositiveInt(raw, label) {\n  const value = Number(raw);\n  if (!Number.isInteger(value) || value < 1)\n    throw new Error(`${label} must be a positive integer`);\n  return value;\n}\n\nfunction parseNonNegativeInt(raw, label) {\n  const value = Number(raw);\n  if (!Number.isInteger(value) || value < 0)\n    throw new Error(`${label} must be a non-negative integer`);\n  return value;\n}","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/harness-cache-audit.mjs#L111-L147","documentation":"harness-cache-audit.mjs parses argv with a closed switch; any unmatched token reaches `default:` and throws `unknown option: <arg>` before any RPC or core spawn happens. Unlike goals-live.mjs's parser, there is no eslint fall-through comment because -h/--help exit directly, but the behavior is the same fail-fast contract.","triggerScenarios":"Passing goals-live-only flags to this script: `--case list`, `--context`, `--reset`, `--show-thoughts`; typos like `--spawncore`; removed/renamed flags from older revisions; double-dash `---verbose`.","commonSituations":"Command lines copied between the sibling debug runners (goals-live.mjs, agent-prepare-context-audit.mjs, harness-subagent-rpc-audit.mjs) that share a flag family but not an identical set; stale shell history after flags were added.","solutions":["Run `node scripts/debug/harness-cache-audit.mjs --help` and use only the listed options","Move goals-specific flags (--case, --context) to scripts/debug/goals-live.mjs","Fix the typo / remove the stray dash","If the flag should exist, add the case plus a usage() line"],"exampleFix":"# before\nnode scripts/debug/harness-cache-audit.mjs --case list\n# Error: unknown option: --case\n\n# after\nnode scripts/debug/goals-live.mjs --case list","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\n  \"--core-url\", \"--token\", \"--workspace\", \"--turns\", \"--model\", \"--thread-id\",\n  \"--rpc-timeout-ms\", \"--prompt\", \"--spawn-core\", \"--isolated-workspace\",\n  \"--keep-workspace\", \"--min-hit-rate\", \"--max-turns-without-cache\", \"--verbose\", \"-h\", \"--help\",\n]);\nconst unknown = process.argv.slice(2).filter((a) => /^--?\\w/.test(a) && !SUPPORTED.has(a));\nif (unknown.length) { console.error(`unsupported: ${unknown.join(\" \")}`); process.exit(2); }","typeGuard":"const isAuditFlag = (f) =>\n  /^--(core-url|token|workspace|turns|model|thread-id|rpc-timeout-ms|prompt|spawn-core|isolated-workspace|keep-workspace|min-hit-rate|max-turns-without-cache|verbose|help)$|^(-h)$/.test(f);","tryCatchPattern":null,"preventionTips":["Namespace per-script flags in shared shell history (prefix comments) so cross-script copies are visible","When a new flag is added here, check whether the sibling runners should get it too — divergence is the root cause"],"tags":["cli","argument-validation","developer-tooling"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}