{"record":{"id":"e850f1c5f97173fd","repo":"Hmbown/CodeWhale","slug":"openai-codex-uses-oauth-run-codex-login-then-g","errorCode":null,"errorMessage":"OpenAI Codex uses OAuth. Run `codex login`, then grant exact read-only access with `codewhale auth external-consent --provider openai-codex --mode read-only`, or set OPENAI_CODEX_ACCESS_TOKEN for this process; Codewhale does not store an API key for this provider.","messagePattern":"OpenAI Codex uses OAuth\\. Run `codex login`, then grant exact read-only access with `codewhale auth external-consent --provider openai-codex --mode read-only`, or set OPENAI_CODEX_ACCESS_TOKEN for this process; Codewhale does not store an API key for this provider\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":10984,"sourceCode":"    route_config: &Config,\n    api_key: &str,\n) -> Result<SavedCredential> {\n    if identity.provider == ApiProvider::Xai {\n        return codewhale_config::with_xai_oauth_revocation_transaction(|| {\n            save_api_key_for_identity_unlocked(identity, route_config, api_key)\n        });\n    }\n    save_api_key_for_identity_unlocked(identity, route_config, api_key)\n}\n\nfn save_api_key_for_identity_unlocked(\n    identity: &ProviderIdentity,\n    route_config: &Config,\n    api_key: &str,\n) -> Result<SavedCredential> {\n    let provider = identity.provider;\n    if provider == ApiProvider::OpenaiCodex {\n        anyhow::bail!(\n            \"OpenAI Codex uses OAuth. Run `codex login`, then grant exact read-only access with `codewhale auth external-consent --provider openai-codex --mode read-only`, or set OPENAI_CODEX_ACCESS_TOKEN for this process; Codewhale does not store an API key for this provider.\"\n        );\n    }\n    let is_legacy_literal_custom = provider == ApiProvider::Custom\n        && identity.key.trim() == ApiProvider::Custom.as_str()\n        && identity.persisted_id().is_none();\n    if matches!(provider, ApiProvider::Deepseek | ApiProvider::DeepseekCN) {\n        return save_api_key(api_key);\n    }\n    if is_legacy_literal_custom {\n        return save_root_api_key_for_secret_slot(api_key, \"custom\", false);\n    }\n\n    let api_key = api_key.trim();\n    anyhow::ensure!(!api_key.is_empty(), \"Refusing to save an empty API key.\");\n\n    let config_path =\n        credential_config_path().context(\"Failed to resolve config path for provider API key.\")?;","sourceCodeStart":10966,"sourceCodeEnd":11002,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/config.rs#L10966-L11002","documentation":"Error \"OpenAI Codex uses OAuth. Run `codex login`, then grant exact read-only access with `codewhale auth external-consent --provider openai-codex --mode read-only`, or set OPENAI_CODEX_ACCESS_TOKEN for this process; Codewhale does not store an API key for this provider.\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/config.rs:10984 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}