{"record":{"id":"5bcb7398f3b41413","repo":"tinyhumansai/openhuman","slug":"provider-mode-must-be-one-of-array-from-provid","errorCode":null,"errorMessage":"--provider-mode must be one of ${Array.from(providerModes).join(\", \")}","messagePattern":"--provider-mode must be one of (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/debug/harness-subagent-rpc-audit.mjs","lineNumber":153,"sourceCode":"        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;\n}\n\nfunction defaultOpenhumanDir() {\n  return process.env.OPENHUMAN_APP_ENV === \"staging\"\n    ? path.join(homedir(), \".openhuman-staging\")\n    : path.join(homedir(), \".openhuman\");","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/debug/harness-subagent-rpc-audit.mjs#L135-L171","documentation":"Post-parse validation in harness-subagent-rpc-audit. opts.providerMode must be one of direct-openai or openhuman-backend — the two inference routings the isolated-workspace config writers know how to generate (a config.toml talking straight to api.openai.com, or one routed through the TinyHumans backend with an app-session JWT).","triggerScenarios":"Passing anything else to --provider-mode: `--provider-mode openai`, `local`, or `anthropic`; a value with trailing whitespace or a placeholder left in a templated wrapper command.","commonSituations":"Assuming a third routing (local model, other vendor) exists; typo; enum grew in a newer revision than the one being run.","solutions":["Pick `--provider-mode direct-openai` (requires OPENAI_API_KEY/OPENAI_KEY) or `--provider-mode openhuman-backend` (requires JWT_TOKEN)","Run `-h` to see the current enum"],"exampleFix":"# before\nnode scripts/debug/harness-subagent-rpc-audit.mjs --isolated-workspace --spawn-core --provider-mode openai\n\n# after\nnode scripts/debug/harness-subagent-rpc-audit.mjs --isolated-workspace --spawn-core --provider-mode direct-openai","handlingStrategy":"validation","validationCode":"const MODES = new Set([\"direct-openai\",\"openhuman-backend\"]);\nconst m = process.env.AUDIT_PROVIDER_MODE ?? \"direct-openai\";\nif (!MODES.has(m)) { console.error(`provider mode must be one of ${[...MODES].join(\", \")}`); process.exit(2); }","typeGuard":"const MODES = new Set([\"direct-openai\",\"openhuman-backend\"]);\nfunction isProviderMode(v) { return typeof v === \"string\" && MODES.has(v); }","tryCatchPattern":null,"preventionTips":["Pick the mode from which credential you have (OPENAI_API_KEY vs JWT_TOKEN), not habit","Re-check -h after pulling script updates"],"tags":["cli","validation","arguments"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}