diegosouzapw/OmniRoute · error · CodexAuthFileError
missing_account_id
missing_account_id
Error message
Unable to derive account_id from the auth.json tokens
What it means
Final validation in parseAndValidateCodexAuth: neither tokens.account_id nor the Codex claim inside the id_token yields an account id. The account id is the deduplication key for Codex connections, so the file cannot be mapped to an account.
Solutions
- Re-login via the Codex CLI so the id_token contains the ChatGPT account claim
- Add tokens.account_id manually only if you know the correct value
- Verify the id_token is a genuine ChatGPT JWT and not corrupted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/oauth/utils/codexAuthImport.ts:159 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/7a6cf8ae45c0247b.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/oauth/utils/codexAuthImport.ts:159
"access_token is missing or empty in the auth.json",
400,
"missing_access_token"
);
}
if (!refreshToken) {
throw new CodexAuthFileError(
"refresh_token is missing or empty in the auth.json",
400,
"missing_refresh_token"
);
}
const tokensAccountId = toNonEmptyString(tokens.account_id) ?? undefined;
const accountId = extractCodexAccountId(idToken, tokensAccountId);
if (!accountId) {
throw new CodexAuthFileError(
"Unable to derive account_id from the auth.json tokens",
400,
"missing_account_id"
);
}
return {
idToken,
accessToken,
refreshToken,
accountId,
userId: extractCodexUserId(idToken),
email: extractJwtEmail(idToken),
expiresAt: extractExpiresAt(accessToken, idToken),
};
}
// ──── Create / update connection ──────────────────────────────────────────────View on GitHub (pinned to a179ffed5b)