{"record":{"id":"102038ff7f795151","repo":"tinyhumansai/openhuman","slug":"scenario-must-be-one-of-array-from-scenarios","errorCode":null,"errorMessage":"--scenario must be one of ${Array.from(scenarios).join(\", \")}","messagePattern":"--scenario must be one of (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/harness-subagent-rpc-audit.mjs","lineNumber":147,"sourceCode":"      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  const scenarios = new Set([\n    \"async-steer\",\n    \"parallel-research-code\",\n    \"reuse-parent-comm\",\n    \"all\",\n  ]);\n  if (!scenarios.has(opts.scenario)) {\n    throw new Error(\n      `--scenario must be one of ${Array.from(scenarios).join(\", \")}`,\n    );\n  }\n  const providerModes = new Set([\"direct-openai\", \"openhuman-backend\"]);\n  if (!providerModes.has(opts.providerMode)) {\n    throw new Error(\n      `--provider-mode must be one of ${Array.from(providerModes).join(\", \")}`,\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  }\n  return value;","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/harness-subagent-rpc-audit.mjs#L129-L165","documentation":"Post-parse validation in harness-subagent-rpc-audit. opts.scenario must be one of the four audit scenarios the script knows how to drive — async-steer, parallel-research-code, reuse-parent-comm, or all — and anything else is rejected before any RPC or workspace work happens.","triggerScenarios":"Passing a scenario name that does not exist (`--scenario parallel-research`), a renamed scenario after a script update, or leaving a placeholder value in a templated command.","commonSituations":"Script revised and a scenario renamed; the value silently swallowed from a different flag; tab-completion guessing.","solutions":["Use exactly one of: async-steer, parallel-research-code, reuse-parent-comm, all","Check `-h` output for the current scenario list if the script was recently updated"],"exampleFix":"# before\nnode scripts/debug/harness-subagent-rpc-audit.mjs --scenario parallel-research\n\n# after\nnode scripts/debug/harness-subagent-rpc-audit.mjs --scenario parallel-research-code","handlingStrategy":"validation","validationCode":"const SCENARIOS = new Set([\"async-steer\",\"parallel-research-code\",\"reuse-parent-comm\",\"all\"]);\nconst s = process.env.AUDIT_SCENARIO ?? \"all\";\nif (!SCENARIOS.has(s)) { console.error(`scenario must be one of ${[...SCENARIOS].join(\", \")}`); process.exit(2); }","typeGuard":"const SCENARIOS = new Set([\"async-steer\",\"parallel-research-code\",\"reuse-parent-comm\",\"all\"]);\nfunction isScenario(v) { return typeof v === \"string\" && SCENARIOS.has(v); }","tryCatchPattern":null,"preventionTips":["Source scenario names from -h output or the usage() string, not memory","Pin wrapper scripts to explicit scenario names"],"tags":["cli","validation","arguments"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}