diegosouzapw/OmniRoute · error · CodexAuthFileError
invalid_auth_file
invalid_auth_file
Error message
Not a Codex auth.json — unexpected auth_mode value
What it means
Error "Not a Codex auth.json — unexpected auth_mode value" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/oauth/utils/codexAuthImport.ts:119
email: string | null;
expiresAt: string | null;
}
export interface CreateConnectionOptions {
name?: string;
email?: string;
overwriteExisting?: boolean;
}
// ──── Parse & validate ────────────────────────────────────────────────────────
export function parseAndValidateCodexAuth(raw: unknown): ParsedCodexAuth {
const doc = toRecord(raw);
// Codex CLI no longer writes auth_mode in auth.json (only OmniRoute's own export
// includes it). Accept both formats as long as the required tokens are present.
if (doc.auth_mode !== undefined && doc.auth_mode !== null && doc.auth_mode !== "chatgpt") {
throw new CodexAuthFileError(
"Not a Codex auth.json — unexpected auth_mode value",
400,
"invalid_auth_file"
);
}
const tokens = toRecord(doc.tokens);
const idToken = toNonEmptyString(tokens.id_token);
const accessToken = toNonEmptyString(tokens.access_token);
const refreshToken = toNonEmptyString(tokens.refresh_token);
if (!idToken) {
throw new CodexAuthFileError(
"id_token is missing or empty in the auth.json",
400,
"missing_id_token"
);
}View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/oauth/utils/codexAuthImport.ts:119 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/05323052f27767de.
Report an issue: GitHub.