{"record":{"id":"3269da52c8d38f63","repo":"tinyhumansai/openhuman","slug":"unknown-option-arg-3269da","errorCode":null,"errorMessage":"unknown option: ${arg}","messagePattern":"unknown option: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/goals-live.mjs","lineNumber":132,"sourceCode":"      case \"--model\":\n        opts.model = next();\n        break;\n      case \"--show-thoughts\":\n        opts.showThoughts = true;\n        break;\n      case \"--rpc-timeout-ms\":\n        opts.rpcTimeoutMs = Number(next());\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      // eslint-disable-next-line no-fallthrough\n      default:\n        throw new Error(`unknown option: ${arg}`);\n    }\n  }\n  if (opts.cases.length === 0) opts.cases = [...ALL_CASES];\n  return opts;\n}\n\n// ── workspace / token resolution (mirrors harness-cache-audit) ──────────────\n\nfunction defaultOpenhumanDir() {\n  return process.env.OPENHUMAN_APP_ENV === \"staging\"\n    ? path.join(homedir(), \".openhuman-staging\")\n    : path.join(homedir(), \".openhuman\");\n}\n\nasync function defaultWorkspace() {\n  if (process.env.OPENHUMAN_WORKSPACE) return process.env.OPENHUMAN_WORKSPACE;\n  const dir = defaultOpenhumanDir();\n  try {","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/goals-live.mjs#L114-L150","documentation":"The argument parser in goals-live.mjs is a closed switch over the supported flags; any argument that matches no case falls into `default:` and throws `unknown option: <arg>`. This is deliberate fail-fast behavior so misspelled or unsupported flags abort before a core is spawned or any RPC spend happens. Note that `-h`/`--help` print usage and exit 0 via fall-through.","triggerScenarios":"Passing a flag from a sibling script that goals-live does not support (e.g. `--turns 4` or `--min-hit-rate`, which belong to harness-cache-audit.mjs), a typo like `--verbos`, or `--token` misspelled. Also any flag listed in harness-cache-audit's usage but absent here (goals-live has --case, harness-cache-audit does not).","commonSituations":"Copy-pasting a command line between the two debug runners (goals-live vs harness-cache-audit vs agent-prepare-context-audit), which share most flags but not all; stale shell history after a flag rename; forgetting that --case is goals-live-only.","solutions":["Run `node scripts/debug/goals-live.mjs --help` and re-issue the command with only the flags it lists","If you meant harness-cache-audit's flag (e.g. --turns), run scripts/debug/harness-cache-audit.mjs instead","Fix the typo in the flag name","If the flag genuinely should exist, add a case to the switch in parseArgs and to usage()"],"exampleFix":"// before\nnode scripts/debug/goals-live.mjs --turns 4 --case reflect\n\n// after\nnode scripts/debug/harness-cache-audit.mjs --turns 4\n// or, for goals-live, drop the foreign flag:\nnode scripts/debug/goals-live.mjs --case reflect","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\n  \"--core-url\", \"--token\", \"--workspace\", \"--case\", \"--reset\", \"--context\",\n  \"--model\", \"--show-thoughts\", \"--rpc-timeout-ms\", \"--verbose\", \"-h\", \"--help\",\n]);\nconst flagLike = /^--?\\w/;\nconst unknown = process.argv.slice(2).filter((a) => flagLike.test(a) && !SUPPORTED.has(a));\nif (unknown.length) {\n  console.error(`unsupported flags for goals-live: ${unknown.join(\" \")}`);\n  process.exit(2);\n}","typeGuard":"const isGoalsLiveFlag = (f) =>\n  /^--(core-url|token|workspace|case|reset|context|model|show-thoughts|rpc-timeout-ms|verbose|help)$|^(-h)$/.test(f);","tryCatchPattern":null,"preventionTips":["Run -h first when reusing a command line across the sibling debug runners","Keep the flag sets of goals-live/harness-cache-audit/agent-prepare-context-audit aligned where possible to reduce cross-script mistakes"],"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"}