{"record":{"id":"60706656089d1a73","repo":"tinyhumansai/openhuman","slug":"unknown-option-arg","errorCode":null,"errorMessage":"unknown option: ${arg}","messagePattern":"unknown option: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/agent-prepare-context-audit.mjs","lineNumber":178,"sourceCode":"        break;\n      case \"--spawn-core\":\n        opts.spawnCore = true;\n        break;\n      case \"--keep-workspace\":\n        opts.keepWorkspace = true;\n        break;\n      case \"--json\":\n        opts.json = true;\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 defaultOpenhumanDir() {\n  if (process.env.OPENHUMAN_APP_ENV === \"staging\") {\n    return path.join(homedir(), \".openhuman-staging\");\n  }\n  if (process.env.OPENHUMAN_APP_ENV) {\n    return path.join(homedir(), \".openhuman\");","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/agent-prepare-context-audit.mjs#L160-L196","documentation":"parseArgs() in scripts/debug/agent-prepare-context-audit.mjs is a strict switch over known flags; any token not matching a case (and not consumed as a value by next()) falls into default and throws 'unknown option: <arg>'. The accepted set is exactly the one in usage(): --core-url, --token, --workspace, --model, --query, --raw, --scout-prompt-file, --thread-prefix, --no-seed-transcript, --max-print-chars, --rpc-timeout-ms, --spawn-core, --keep-workspace, --json, --verbose, -h/--help.","triggerScenarios":"A typo'd or unsupported flag anywhere in argv, e.g. --jsn, --tokn, --spawn_core (underscore instead of dash), or a flag from a different debug script (like goals-live.mjs's --isolated-workspace or --case) passed to this one. Boolean flags that don't exist here are the most common hit.","commonSituations":"Copy-pasting option lines between the sibling debug runners (harness-cache-audit.mjs, goals-live.mjs) whose flag sets differ; muscle-memory underscores; abbreviating flags that the parser does not support.","solutions":["Run with -h/--help and diff your command against the printed option list","Fix the typo — most commonly an underscore where a dash belongs (--spawn-core, --keep-workspace)","Move options that belong to a different script back to that script; this audit tool has no --case/--reset equivalents"],"exampleFix":"# before\n$ node scripts/debug/agent-prepare-context-audit.mjs --spawn_core\nError: unknown option: --spawn_core\n\n# after\n$ node scripts/debug/agent-prepare-context-audit.mjs --spawn-core","handlingStrategy":"validation","validationCode":"const KNOWN = new Set([\"--core-url\",\"--token\",\"--workspace\",\"--model\",\"--query\",\"--raw\",\"--scout-prompt-file\",\"--thread-prefix\",\"--no-seed-transcript\",\"--max-print-chars\",\"--rpc-timeout-ms\",\"--spawn-core\",\"--keep-workspace\",\"--json\",\"--verbose\",\"-h\",\"--help\"]);\nconst unknown = argv.filter((a) => a.startsWith(\"-\") && !KNOWN.has(a));\nif (unknown.length) { console.error(`unknown options: ${unknown.join(\", \")}`); process.exit(2); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run -h once per session when switching between sibling debug scripts — their flag sets intentionally differ","Use dashes, never underscores, in these flags","Let a wrapper script own the flag list so typos are caught by completion/lint instead of at runtime"],"tags":["cli","arguments","usage"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}