{"record":{"id":"cc85da5f802ff281","repo":"tinyhumansai/openhuman","slug":"missing-value-for-arg-cc85da","errorCode":null,"errorMessage":"missing value for ${arg}","messagePattern":"missing value for (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/goals-live.mjs","lineNumber":78,"sourceCode":"    token: process.env.OPENHUMAN_CORE_TOKEN || \"\",\n    workspace: process.env.OPENHUMAN_WORKSPACE || \"\",\n    spawnCore: false,\n    isolatedWorkspace: false,\n    keepWorkspace: false,\n    cases: [],\n    reset: false,\n    context: \"\",\n    model: \"\",\n    showThoughts: false,\n    rpcTimeoutMs: 600_000,\n    verbose: false,\n    coreUrlExplicit: Boolean(process.env.OPENHUMAN_CORE_RPC_URL),\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 === undefined) 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 \"--spawn-core\":\n        opts.spawnCore = true;\n        break;\n      case \"--isolated-workspace\":\n        opts.isolatedWorkspace = true;","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/goals-live.mjs#L60-L96","documentation":"parseArgs() in scripts/debug/goals-live.mjs (live test harness for the memory_goals domain) uses the same next() pattern as its sibling scripts: value-taking options (--core-url, --token, --workspace, --case, --context, --model, --rpc-timeout-ms) consume the following argv token, and when none exists the helper throws 'missing value for <flag>'.","triggerScenarios":"Invoking goals-live.mjs with a value-taking flag as the final token, e.g. `node scripts/debug/goals-live.mjs --context` or `pnpm debug goals-live --model`. The check fires before any validation of the value itself, so `--case` with no argument fails here rather than with the 'unknown case' error.","commonSituations":"Building the command incrementally and stopping after the flag; shell wrappers dropping an unquoted empty argument; copying a partial command from the usage examples at the top of the file where the value was on the next line.","solutions":["Append the value immediately after the flag: --model <model-id>","Drop flags you don't need rather than leaving them valueless","Prefer environment forms for optional values (OPENHUMAN_CORE_TOKEN, OPENHUMAN_WORKSPACE) which never dangle"],"exampleFix":"# before\n$ node scripts/debug/goals-live.mjs --case\nError: missing value for --case\n\n# after\n$ node scripts/debug/goals-live.mjs --case reflect --context \"shipping focus\"","handlingStrategy":"validation","validationCode":"const VALUE_FLAGS = new Set([\"--core-url\", \"--token\", \"--workspace\", \"--case\", \"--context\", \"--model\", \"--rpc-timeout-ms\"]);\nfor (let i = 0; i < argv.length; i++) {\n  if (VALUE_FLAGS.has(argv[i]) && (i + 1 >= argv.length || argv[i + 1].startsWith(\"--\"))) {\n    console.error(`${argv[i]} requires a value`); process.exit(2);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep flag and value on one token when values may be empty: --context=\"\" style is not supported, so validate upstream","Use OPENHUMAN_CORE_TOKEN / OPENHUMAN_WORKSPACE env forms for optional configuration","Write wrapper npm scripts (pnpm debug goals-live ...) with fully-formed argument lists instead of composing flags ad hoc"],"tags":["cli","arguments","usage"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}