{"record":{"id":"4ff79cfc2e9b451a","repo":"openai/codex","slug":"auth-refresh-returned-invalid-credentials","errorCode":null,"errorMessage":"auth refresh returned invalid credentials","messagePattern":"auth refresh returned invalid credentials","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/app-server/src/external_auth.rs","lineNumber":75,"sourceCode":"            Err(_) => {\n                let _canceled = self.outgoing.cancel_request(&request_id).await;\n                return Err(std::io::Error::other(format!(\n                    \"auth refresh request timed out after {}s\",\n                    EXTERNAL_AUTH_REFRESH_TIMEOUT.as_secs()\n                )));\n            }\n        };\n\n        // Don't propagate parser error messages because they may contain a token.\n        let response: ChatgptAuthTokensRefreshResponse = serde_json::from_value(result)\n            .map_err(|_| std::io::Error::other(\"invalid auth refresh response\"))?;\n        let auth = CodexAuth::from_external_chatgpt_tokens(\n            response.access_token.as_str(),\n            response.chatgpt_account_id.as_str(),\n            response.chatgpt_plan_type.as_deref(),\n        )\n        .map_err(|err| {\n            std::io::Error::new(err.kind(), \"auth refresh returned invalid credentials\")\n        })?;\n        *self\n            .auth\n            .write()\n            .map_err(|_| std::io::Error::other(\"external auth lock is poisoned\"))? = auth.clone();\n        Ok(auth)\n    }\n}\n\nimpl ExternalAuth for ExternalAuthBridge {\n    fn resolve(&self) -> ExternalAuthFuture<'_, CodexAuth> {\n        Box::pin(async {\n            self.auth\n                .read()\n                .map(|auth| auth.clone())\n                .map_err(|_| std::io::Error::other(\"external auth lock is poisoned\"))\n        })\n    }","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/app-server/src/external_auth.rs#L57-L93","documentation":"Error \"auth refresh returned invalid credentials\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/app-server/src/external_auth.rs:75 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":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}