{"record":{"id":"e39fdf19a72860f2","repo":"Hmbown/CodeWhale","slug":"codex-credential-file-is-not-valid-credential-j","errorCode":null,"errorMessage":"Codex credential file {} is not valid credential JSON","messagePattern":"Codex credential file (.+?) is not valid credential JSON","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/oauth.rs","lineNumber":111,"sourceCode":"            // 60-second safety margin\n            now + 60 >= exp\n        }\n        // If we can't prove freshness, fail closed. External credentials are\n        // never refreshed by Codewhale.\n        None => true,\n    }\n}\n\n/// Load Codex credentials from the auth file.\n///\n/// Returns `Ok(None)` if the file doesn't exist or has no usable tokens.\n/// Returns `Err` only on parse/IO errors that aren't \"file not found\".\nfn load_credentials(grant: &ExternalCredentialReadGrant) -> Result<Option<CodexCredentials>> {\n    let Some(contents) = crate::external_credentials::read_to_string(grant)? else {\n        return Ok(None);\n    };\n    let auth: CodexAuthFile = serde_json::from_str(&contents).map_err(|_| {\n        anyhow::anyhow!(\n            \"Codex credential file {} is not valid credential JSON\",\n            codewhale_config::quote_os_path(grant.path())\n        )\n    })?;\n    let tokens = match auth.tokens {\n        Some(t) => t,\n        None => return Ok(None),\n    };\n    let access_token = match tokens.access_token {\n        Some(t) if !t.trim().is_empty() => t,\n        _ => return Ok(None),\n    };\n    Ok(Some(CodexCredentials {\n        access_token,\n        account_id: tokens.account_id,\n    }))\n}\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/oauth.rs#L93-L129","documentation":"Error \"Codex credential file {} is not valid credential JSON\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/oauth.rs:111 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"}