{"record":{"id":"1c1a65c187031adc","repo":"Yeachan-Heo/oh-my-codex","slug":"unsupported-codex-login-flag-for-omx-auth-add-a","errorCode":null,"errorMessage":"unsupported codex login flag for omx auth add: ${arg}","messagePattern":"unsupported codex login flag for omx auth add: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/auth.ts","lineNumber":34,"sourceCode":"  omx auth list [--json]   List registered auth slots and local quota metadata\n  omx auth use <slot>      Atomically switch live Codex auth.json to a slot\n  omx auth --help          Show this help\n\nAuth slots are stored under ~/.omx/auth/<slot>.json with owner-only permissions.\n`;\n\nfunction wantsJson(args: string[]): boolean {\n  return args.includes(\"--json\");\n}\nconst DEFAULT_SUBSCRIPTION_MODEL = \"gpt-5-codex\";\nconst DEFAULT_SUBSCRIPTION_MODEL_PROVIDER = \"openai-chatgpt\";\n\n\nfunction validateCodexLoginArgs(args: string[]): void {\n  const allowed = new Set([\"--device-auth\", \"--with-api-key\", \"--with-access-token\"]);\n  for (const arg of args) {\n    if (!allowed.has(arg)) {\n      throw new Error(`unsupported codex login flag for omx auth add: ${arg}`);\n    }\n  }\n}\n\nfunction runCodexLogin(cwd: string, env: NodeJS.ProcessEnv, loginArgs: string[] = []): void {\n  validateCodexLoginArgs(loginArgs);\n  const { result } = spawnPlatformCommandSync(\"codex\", [\"login\", ...loginArgs], {\n    cwd,\n    env,\n    stdio: \"inherit\",\n    encoding: \"utf-8\",\n  });\n  if (result.error) {\n    const error = result.error as NodeJS.ErrnoException;\n    const kind = classifySpawnError(error);\n    if (kind === \"missing\") throw new Error(\"failed to launch codex login: executable not found in PATH\");\n    if (kind === \"blocked\") throw new Error(`failed to launch codex login: executable is blocked (${error.code || \"blocked\"})`);\n    throw error;","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/auth.ts#L16-L52","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the unsupported flag; only use --device-auth, --with-api-key, or --with-access-token","Check the omx docs/changelog for newly supported flags and upgrade omx if the flag was added","Perform advanced codex login flows directly with the codex CLI instead of via omx auth add"],"exampleFix":"# before\nomx auth add work --force-new\n# after\nomx auth add work --device-auth","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--device-auth','--with-api-key','--with-access-token']);\nconst safe = loginArgs.every(a => ALLOWED.has(a));\nif (!safe) throw new Error('unsupported codex login flag');","typeGuard":"const isAllowedLoginFlag = (f: string): f is '--device-auth'|'with-api-key'|'--with-access-token' => ALLOWED.has(f);","tryCatchPattern":"catch (e) { if (/unsupported codex login flag/.test(String(e))) { stripUnsupportedFlagsAndRetry(); } else throw e; }","preventionTips":["Filter flags through the whitelist before calling omx auth add","Track omx releases when new codex flags appear","Use codex CLI directly for exotic flows"],"tags":["auth","cli","flag-validation","codex"],"backgroundTag":"unsupported-cli-flag","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}