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

Unknown auth command: ${command}\n${AUTH_HELP.trim()}

Error message

Unknown auth command: ${command}\n${AUTH_HELP.trim()}

What it means

The `omx auth` dispatcher only handles a fixed set of subcommands (help/list/add/use etc.); anything else falls through to this error, which echoes the unknown command and appends the full auth help text for reference.

Source

Thrown at src/cli/auth.ts:156

    }
    for (const slot of slots) {
      const quota = slot.exhaustedAt ? ` exhausted=${slot.exhaustedAt}` : slot.lastQuotaAt ? ` last-quota=${slot.lastQuotaAt}` : "";
      const used = slot.lastUsedAt ? ` last-used=${slot.lastUsedAt}` : "";
      console.log(`${slot.slot}${used}${quota}`);
    }
    return;
  }

  if (command === "use") {
    const slot = args[1];
    if (!slot) throw new Error("Usage: omx auth use <slot>");
    const liveAuthPath = resolveLiveAuthPath(cwd, env, home);
    const record = await useSlot(slot, liveAuthPath, home);
    console.log(`Using auth slot ${record.slot}`);
    return;
  }

  throw new Error(`Unknown auth command: ${command}\n${AUTH_HELP.trim()}`);
}

export function formatAuthError(err: unknown): string {
  return redactAuthSecrets(err);
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Read the AUTH_HELP text included in the error — it lists valid subcommands
  2. Use the correct verb: add to create a slot, use to activate one
  3. Check `omx auth --help` for the current subcommand set in your version

Example fix

# before
omx auth switch work
# after
omx auth use work
Defensive patterns

Strategy: validation

Validate before calling

const VALID = new Set(['list','add','use','help']);
if (!VALID.has(command)) { console.error(AUTH_HELP); process.exit(1); }

Type guard

const isAuthCommand = (c: string): c is 'list'|'add'|'use'|'help' => ['list','add','use','help'].includes(c);

Try / catch

catch (e) { if (/^Unknown auth command:/.test(String(e))) { printAuthHelp(); } else throw e; }

Prevention

When it happens

Trigger: Running `omx auth login`, `omx auth switch`, `omx auth delete`, or any subcommand outside the implemented set.

Common situations: Naming drift from other CLIs (login vs add, switch vs use); typos; older omx docs referencing removed subcommands.

Related errors


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