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

Usage: omx auth use <slot>

Error message

Usage: omx auth use <slot>

What it means

`omx auth use` activates a stored credential slot and requires the slot name as its positional argument. Omitting it aborts with this usage error before any auth state is touched.

Source

Thrown at src/cli/auth.ts:149

    if (wantsJson(args)) {
      console.log(JSON.stringify({ slots, config: { rotation: config.rotation, priority: config.priority } }, null, 2));
      return;
    }
    if (slots.length === 0) {
      console.log("No auth slots configured. Run `omx auth add <slot>` first.");
      return;
    }
    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. Pass the slot name you created with `omx auth add`, e.g. `omx auth use work`
  2. List your slots first (e.g. `omx auth list`/help) to recall exact names
  3. Quote script variables: `omx auth use "$SLOT"`

Example fix

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

Strategy: validation

Validate before calling

const slot = process.argv[3];
if (!slot) { console.error('Usage: omx auth use <slot>'); process.exit(1); }

Type guard

const isNonEmptySlot = (s?: string): s is string => typeof s === 'string' && s.length > 0;

Try / catch

catch (e) { if (/^Usage: omx auth use/.test(String(e))) { listSlotsThenExit(); } else throw e; }

Prevention

When it happens

Trigger: Running `omx auth use` with no arguments.

Common situations: Users assuming the command lists or interactively picks slots; empty shell variables in scripts; forgetting the slot name they created earlier.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


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