tinyhumansai/openhuman · error · Error

--provider-mode must be one of ${Array.from(providerModes).j

Error message

--provider-mode must be one of ${Array.from(providerModes).join(", ")}

What it means

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).

Source

Thrown at scripts/debug/harness-subagent-rpc-audit.mjs:153

        process.exit(0);
      default:
        throw new Error(`unknown option: ${arg}`);
    }
  }
  const scenarios = new Set([
    "async-steer",
    "parallel-research-code",
    "reuse-parent-comm",
    "all",
  ]);
  if (!scenarios.has(opts.scenario)) {
    throw new Error(
      `--scenario must be one of ${Array.from(scenarios).join(", ")}`,
    );
  }
  const providerModes = new Set(["direct-openai", "openhuman-backend"]);
  if (!providerModes.has(opts.providerMode)) {
    throw new Error(
      `--provider-mode must be one of ${Array.from(providerModes).join(", ")}`,
    );
  }
  return opts;
}

function parsePositiveInt(raw, label) {
  const value = Number(raw);
  if (!Number.isInteger(value) || value < 1) {
    throw new Error(`${label} must be a positive integer`);
  }
  return value;
}

function defaultOpenhumanDir() {
  return process.env.OPENHUMAN_APP_ENV === "staging"
    ? path.join(homedir(), ".openhuman-staging")
    : path.join(homedir(), ".openhuman");

View on GitHub (pinned to a221052e0d)

Solutions

  1. Pick `--provider-mode direct-openai` (requires OPENAI_API_KEY/OPENAI_KEY) or `--provider-mode openhuman-backend` (requires JWT_TOKEN)
  2. Run `-h` to see the current enum

Example fix

# before
node scripts/debug/harness-subagent-rpc-audit.mjs --isolated-workspace --spawn-core --provider-mode openai

# after
node scripts/debug/harness-subagent-rpc-audit.mjs --isolated-workspace --spawn-core --provider-mode direct-openai
Defensive patterns

Strategy: validation

Validate before calling

const MODES = new Set(["direct-openai","openhuman-backend"]);
const m = process.env.AUDIT_PROVIDER_MODE ?? "direct-openai";
if (!MODES.has(m)) { console.error(`provider mode must be one of ${[...MODES].join(", ")}`); process.exit(2); }

Type guard

const MODES = new Set(["direct-openai","openhuman-backend"]);
function isProviderMode(v) { return typeof v === "string" && MODES.has(v); }

Prevention

When it happens

Trigger: 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.

Common situations: Assuming a third routing (local model, other vendor) exists; typo; enum grew in a newer revision than the one being run.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/5bcb7398f3b41413. Report an issue: GitHub.