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

unsupported codex login flag for omx auth add: ${arg}

Error message

unsupported codex login flag for omx auth add: ${arg}

What it means

`omx auth add` forwards extra flags to the underlying `codex login` process, but only a whitelist is allowed: --device-auth, --with-api-key, --with-access-token. Any other flag in the login args is rejected before spawning, preventing arbitrary or unsupported options from reaching codex.

Source

Thrown at src/cli/auth.ts:34

  omx auth list [--json]   List registered auth slots and local quota metadata
  omx auth use <slot>      Atomically switch live Codex auth.json to a slot
  omx auth --help          Show this help

Auth slots are stored under ~/.omx/auth/<slot>.json with owner-only permissions.
`;

function wantsJson(args: string[]): boolean {
  return args.includes("--json");
}
const DEFAULT_SUBSCRIPTION_MODEL = "gpt-5-codex";
const DEFAULT_SUBSCRIPTION_MODEL_PROVIDER = "openai-chatgpt";


function validateCodexLoginArgs(args: string[]): void {
  const allowed = new Set(["--device-auth", "--with-api-key", "--with-access-token"]);
  for (const arg of args) {
    if (!allowed.has(arg)) {
      throw new Error(`unsupported codex login flag for omx auth add: ${arg}`);
    }
  }
}

function runCodexLogin(cwd: string, env: NodeJS.ProcessEnv, loginArgs: string[] = []): void {
  validateCodexLoginArgs(loginArgs);
  const { result } = spawnPlatformCommandSync("codex", ["login", ...loginArgs], {
    cwd,
    env,
    stdio: "inherit",
    encoding: "utf-8",
  });
  if (result.error) {
    const error = result.error as NodeJS.ErrnoException;
    const kind = classifySpawnError(error);
    if (kind === "missing") throw new Error("failed to launch codex login: executable not found in PATH");
    if (kind === "blocked") throw new Error(`failed to launch codex login: executable is blocked (${error.code || "blocked"})`);
    throw error;

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Remove the unsupported flag; only use --device-auth, --with-api-key, or --with-access-token
  2. Check the omx docs/changelog for newly supported flags and upgrade omx if the flag was added
  3. Perform advanced codex login flows directly with the codex CLI instead of via omx auth add

Example fix

# before
omx auth add work --force-new
# after
omx auth add work --device-auth
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['--device-auth','--with-api-key','--with-access-token']);
const safe = loginArgs.every(a => ALLOWED.has(a));
if (!safe) throw new Error('unsupported codex login flag');

Type guard

const isAllowedLoginFlag = (f: string): f is '--device-auth'|'with-api-key'|'--with-access-token' => ALLOWED.has(f);

Try / catch

catch (e) { if (/unsupported codex login flag/.test(String(e))) { stripUnsupportedFlagsAndRetry(); } else throw e; }

Prevention

When it happens

Trigger: Running `omx auth add myslot --force` or any flag outside the allowed set; passing codex-native flags like `--headless` that this wrapper does not (yet) support.

Common situations: Users copying flags from `codex login --help` into the omx wrapper; version skew where newer codex flags are not yet whitelisted in omx; scripts with hardcoded legacy flags.

Related errors


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