tinyhumansai/openhuman · error · Error

missing value for ${arg}

Error message

missing value for ${arg}

What it means

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.

Source

Thrown at scripts/debug/harness-cache-audit.mjs:74

    turns: 3,
    model: "",
    threadId: `harness-cache-audit-${Date.now().toString(36)}`,
    rpcTimeoutMs: 600_000,
    prompt: "",
    spawnCore: false,
    isolatedWorkspace: false,
    keepWorkspace: false,
    minHitRate: 1,
    maxTurnsWithoutCache: 1,
    verbose: false,
    coreUrlExplicit: Boolean(process.env.OPENHUMAN_CORE_RPC_URL),
  };

  for (let i = 0; i < argv.length; i += 1) {
    const arg = argv[i];
    const next = () => {
      const value = argv[++i];
      if (!value) throw new Error(`missing value for ${arg}`);
      return value;
    };
    switch (arg) {
      case "--core-url":
        opts.coreUrl = next();
        opts.coreUrlExplicit = true;
        break;
      case "--token":
        opts.token = next();
        break;
      case "--workspace":
        opts.workspace = next();
        break;
      case "--turns":
        opts.turns = parsePositiveInt(next(), "--turns");
        break;
      case "--model":
        opts.model = next();

View on GitHub (pinned to a221052e0d)

Solutions

  1. Supply the missing value: `--token <value>`
  2. If the value is genuinely empty/unset, remove the flag — every value flag has a default
  3. When forwarding through pnpm debug, double-check quoting: `pnpm debug harness-cache-audit -- --model gpt-4.1-mini`
  4. Echo the composed command (set -x) in wrappers to see the dangling flag

Example fix

# before
node scripts/debug/harness-cache-audit.mjs --turns
# Error: missing value for --turns

# after
node scripts/debug/harness-cache-audit.mjs --turns 4
Defensive patterns

Strategy: validation

Validate before calling

const VALUE_FLAGS = new Set(["--core-url", "--token", "--workspace", "--turns", "--model", "--thread-id", "--rpc-timeout-ms", "--prompt", "--min-hit-rate", "--max-turns-without-cache"]);
for (let i = 0; i < argv.length; i += 1) {
  if (VALUE_FLAGS.has(argv[i]) && (i + 1 >= argv.length || argv[i + 1] === "")) {
    console.error(`${argv[i]} needs a value`);
    process.exit(2);
  }
  if (VALUE_FLAGS.has(argv[i])) i += 1;
}

Prevention

When it happens

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

Common situations: 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 ""`).

Related errors


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