Yeachan-Heo/oh-my-codex · error · Error

Unknown argument for "omx team api": ${token}

Error message

Unknown argument for "omx team api": ${token}

What it means

Thrown when a token in `omx team api` argument parsing matches none of --json, --input, --input=, or their value slot. The unknown token name is included so you can see which argument was rejected.

Source

Thrown at src/cli/team.ts:564

        throw new Error(`Invalid --input JSON: ${error instanceof Error ? error.message : String(error)}`);
      }
      i += 1;
      continue;
    }
    if (token.startsWith('--input=')) {
      const raw = token.slice('--input='.length);
      try {
        const parsed = JSON.parse(raw) as unknown;
        if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
          throw new Error('input must be a JSON object');
        }
        input = parsed as Record<string, unknown>;
      } catch (error) {
        throw new Error(`Invalid --input JSON: ${error instanceof Error ? error.message : String(error)}`);
      }
      continue;
    }
    throw new Error(`Unknown argument for "omx team api": ${token}`);
  }
  return { operation, input, json };
}

function slugifyTask(task: string): string {
  return task
    .toLowerCase()
    .replace(/[^a-z0-9]+/g, '-')
    .replace(/-+/g, '-')
    .replace(/^-|-$/g, '')
    .slice(0, 30) || 'team-task';
}

function snapshotHasDeadWorkerStall(snapshot: TeamSnapshot): boolean {
  return snapshot.deadWorkers.length > 0 && (snapshot.tasks.pending + snapshot.tasks.in_progress) > 0;
}

function buildDeadWorkerAwaitEvent(teamName: string, snapshot: TeamSnapshot): TeamEvent | null {

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Remove or correct the token named in the message; only --json, --input <json>, and --input=<json> are accepted.
  2. Re-check the subcommand's usage string: `omx team api <operation> [--input <json>] [--json]`.
  3. If you expected the flag to exist, verify your installed CLI version's supported flags.

Example fix

# before
omx team api list --jsn
# after
omx team api list --json
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['--json', '--input']);
for (const t of args.slice(1)) {
  if (!ALLOWED.has(t) && !t.startsWith('--input=')) {
    console.error(`Unknown argument: ${t}`); process.exit(2);
  }
}

Type guard

const isKnownTeamApiFlag = (t: string): boolean =>
  t === '--json' || t === '--input' || t.startsWith('--input=');

Try / catch

try { await teamApi(args); } catch (e) {
  if (e instanceof Error && e.message.startsWith('Unknown argument for "omx team api"')) { /* strip offending token, show usage */ }
  else throw e;
}

Prevention

When it happens

Trigger: Typos like `--jsn` or `--Input`, or passing flags from another subcommand such as `omx team api <op> --tail-lines 50`.

Common situations: Copy-pasting flag sets between subcommands, autocomplete inserting wrong flags, or version differences where a flag was removed/renamed.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/7db638b192b87de8. Report an issue: GitHub.