{"record":{"id":"8f50ff1262d17270","repo":"tinyhumansai/openhuman","slug":"missing-value-for-arg-8f50ff","errorCode":null,"errorMessage":"missing value for ${arg}","messagePattern":"missing value for (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/harness-cache-audit.mjs","lineNumber":74,"sourceCode":"    turns: 3,\n    model: \"\",\n    threadId: `harness-cache-audit-${Date.now().toString(36)}`,\n    rpcTimeoutMs: 600_000,\n    prompt: \"\",\n    spawnCore: false,\n    isolatedWorkspace: false,\n    keepWorkspace: false,\n    minHitRate: 1,\n    maxTurnsWithoutCache: 1,\n    verbose: false,\n    coreUrlExplicit: Boolean(process.env.OPENHUMAN_CORE_RPC_URL),\n  };\n\n  for (let i = 0; i < argv.length; i += 1) {\n    const arg = argv[i];\n    const next = () => {\n      const value = argv[++i];\n      if (!value) throw new Error(`missing value for ${arg}`);\n      return value;\n    };\n    switch (arg) {\n      case \"--core-url\":\n        opts.coreUrl = next();\n        opts.coreUrlExplicit = true;\n        break;\n      case \"--token\":\n        opts.token = next();\n        break;\n      case \"--workspace\":\n        opts.workspace = next();\n        break;\n      case \"--turns\":\n        opts.turns = parsePositiveInt(next(), \"--turns\");\n        break;\n      case \"--model\":\n        opts.model = next();","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/harness-cache-audit.mjs#L56-L92","documentation":"The argv parser in harness-cache-audit.mjs consumes values via a next() helper that advances the index and throws if the slot is missing or empty. This error means a value-taking flag (--core-url, --token, --workspace, --turns, --model, --thread-id, --rpc-timeout-ms, --prompt, --min-hit-rate, --max-turns-without-cache) was the last token on the command line or was followed by an empty string.","triggerScenarios":"`node scripts/debug/harness-cache-audit.mjs --token` as the final argument (value forgotten); a shell line truncated by copy-paste or a trailing backslash/newline mishap; a wrapper script joining flags where the value variable expanded to empty/unset (e.g. `--model $MODEL` with MODEL unset yields empty string only if quoted; unquoted disappears entirely, quoted-empty triggers this).","commonSituations":"Rushed terminal typing; CI env var not exported so the composed command ends with a dangling flag; quoting mistakes when forwarding arguments through pnpm (`pnpm debug harness-cache-audit -- --model \"\"`).","solutions":["Supply the missing value: `--token <value>`","If the value is genuinely empty/unset, remove the flag — every value flag has a default","When forwarding through pnpm debug, double-check quoting: `pnpm debug harness-cache-audit -- --model gpt-4.1-mini`","Echo the composed command (set -x) in wrappers to see the dangling flag"],"exampleFix":"# before\nnode scripts/debug/harness-cache-audit.mjs --turns\n# Error: missing value for --turns\n\n# after\nnode scripts/debug/harness-cache-audit.mjs --turns 4","handlingStrategy":"validation","validationCode":"const VALUE_FLAGS = new Set([\"--core-url\", \"--token\", \"--workspace\", \"--turns\", \"--model\", \"--thread-id\", \"--rpc-timeout-ms\", \"--prompt\", \"--min-hit-rate\", \"--max-turns-without-cache\"]);\nfor (let i = 0; i < argv.length; i += 1) {\n  if (VALUE_FLAGS.has(argv[i]) && (i + 1 >= argv.length || argv[i + 1] === \"\")) {\n    console.error(`${argv[i]} needs a value`);\n    process.exit(2);\n  }\n  if (VALUE_FLAGS.has(argv[i])) i += 1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compose commands in wrappers from an array of defined-or-omitted parts, never string concatenation with possibly-empty vars","Prefer `set -x` (or echo the argv array) when debugging CI-invoked debug runners"],"tags":["cli","argument-validation","shell-quoting"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}