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

Usage: omx team api <operation> [--input <json>] [--json]\nS

Error message

Usage: omx team api <operation> [--input <json>] [--json]\nSupported operations: ${TEAM_API_OPERATIONS.join(', ')}

What it means

Thrown by parseTeamApiArgs when the first argument to `omx team api` does not resolve to a known TeamApiOperation (empty or unrecognized). It's a usage error that also lists the supported operations via TEAM_API_OPERATIONS.join(', ').

Source

Thrown at src/cli/team.ts:526

export interface ParsedTeamStartArgs {
  parsed: ParsedTeamArgs;
  worktreeMode: WorktreeMode;
}

function resolveDefaultTeamWorktreeMode(mode: WorktreeMode): WorktreeMode {
  if (mode.enabled) return mode;
  return { enabled: true, detached: true, name: null };
}

function parseTeamApiArgs(args: string[]): {
  operation: TeamApiOperation;
  input: Record<string, unknown>;
  json: boolean;
} {
  const operation = resolveTeamApiOperation(args[0] || '');
  if (!operation) {
    throw new Error(`Usage: omx team api <operation> [--input <json>] [--json]\nSupported operations: ${TEAM_API_OPERATIONS.join(', ')}`);
  }
  let input: Record<string, unknown> = {};
  let json = false;
  for (let i = 1; i < args.length; i += 1) {
    const token = args[i];
    if (token === '--json') {
      json = true;
      continue;
    }
    if (token === '--input') {
      const next = args[i + 1];
      if (!next) throw new Error('Missing value after --input');
      try {
        const parsed = JSON.parse(next) 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>;

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run with one of the operations listed in the error message (TEAM_API_OPERATIONS).
  2. Check the current TEAM_API_OPERATIONS constant/source for your installed version to confirm available names.
  3. Update scripts/aliases that reference a renamed operation.

Example fix

# before
omx team api get-member --json
# after
omx team api <supported-operation> --json   # e.g. one of the names in the error message
Defensive patterns

Strategy: validation

Validate before calling

if (!TEAM_API_OPERATIONS.includes(args[0])) {
  console.error('Supported operations: ' + TEAM_API_OPERATIONS.join(', '));
  process.exit(2);
}

Type guard

const isTeamApiOperation = (v: string): v is TeamApiOperation =>
  (TEAM_API_OPERATIONS as readonly string[]).includes(v);

Try / catch

try { await teamApi(args); } catch (e) {
  if (e instanceof Error && e.message.startsWith('Usage: omx team api')) { /* show help, exit 2 */ }
  else throw e;
}

Prevention

When it happens

Trigger: Running `omx team api` with no operation, or with a misspelled/unknown operation such as `omx team api list-member` when the supported set doesn't include it.

Common situations: Version drift where an operation was renamed or removed, tab-completion or scripts referencing old operation names, or forgetting the operation argument entirely.

Related errors


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