tinyhumansai/openhuman · error · Error

unknown arg: ${a}

Error message

unknown arg: ${a}

What it means

Strict argument parsing in scripts/rabbit/cli.mjs: after the subcommand (default `run`), only --dry-run, --max <n>, --pr <n>, --grace <sec> and -h/--help are recognized. Any other token throws `unknown arg` immediately.

Source

Thrown at scripts/rabbit/cli.mjs:71

function parseArgs(argv) {
  const out = {
    cmd: argv[0] ?? "run",
    max: 5,
    dryRun: false,
    pr: null,
    graceSec: 30,
  };
  for (let i = 1; i < argv.length; i++) {
    const a = argv[i];
    if (a === "--dry-run") out.dryRun = true;
    else if (a === "--max") out.max = Number(argv[++i]);
    else if (a === "--pr") out.pr = Number(argv[++i]);
    else if (a === "--grace") out.graceSec = Number(argv[++i]);
    else if (a === "-h" || a === "--help") {
      out.cmd = "help";
    } else {
      throw new Error(`unknown arg: ${a}`);
    }
  }
  return out;
}

// Convert "1 hour and 5 minutes and 30 seconds" / "46 seconds" / "5 minutes"
// to seconds. CR uses `**46 seconds**` style — strip markdown asterisks first.
function parseWaitSeconds(body) {
  const m = body.match(/Please wait\s+([^.<]+?)\s+before requesting/i);
  if (!m) return null;
  const raw = m[1].replace(/\*+/g, "").trim();
  const parts = raw.split(/\s*(?:,|and)\s*/i);
  let total = 0;
  for (const part of parts) {
    const pm = part.match(/^(\d+)\s*(second|minute|hour)s?$/i);
    if (!pm) return null;
    const n = Number(pm[1]);
    const unit = pm[2].toLowerCase();

View on GitHub (pinned to a221052e0d)

Solutions

  1. Run `node scripts/rabbit/cli.mjs -h` (or `help`) to list accepted args
  2. Map guesses to real flags: use `--max` for a count, `--pr` to target one PR, `--grace` for the wait override
  3. Remove unsupported flags — there is no --force/--yes in this CLI; safety is expressed via --dry-run

Example fix

# before
node scripts/rabbit/cli.mjs run --limit 3 --force

# after
node scripts/rabbit/cli.mjs run --max 3 --dry-run
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--dry-run', '--max', '--pr', '--grace', '-h', '--help']);
const unknown = argv.filter(a => a.startsWith('--') && !KNOWN.has(a));
if (unknown.length) {
  console.error(`Unknown args: ${unknown.join(', ')} — allowed: --dry-run --max N --pr N --grace N -h/--help`);
  process.exit(2);
}

Prevention

When it happens

Trigger: Passing `--limit 10` (should be `--max 10`), `--force`, or abbreviations the parser does not support; also a flag whose expected value is missing silently consumes the next token, which can surface as a confusing unknown-arg one position later.

Common situations: Guessing flag names by analogy with gh/other repo CLIs; copy-pasting a command from an older revision of the script.

Related errors


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