openai/codex · error · std::io::Error
auth refresh returned invalid credentials
Error message
auth refresh returned invalid credentials
What it means
Error "auth refresh returned invalid credentials" thrown in openai/codex.
Source
Thrown at codex-rs/app-server/src/external_auth.rs:75
Err(_) => {
let _canceled = self.outgoing.cancel_request(&request_id).await;
return Err(std::io::Error::other(format!(
"auth refresh request timed out after {}s",
EXTERNAL_AUTH_REFRESH_TIMEOUT.as_secs()
)));
}
};
// Don't propagate parser error messages because they may contain a token.
let response: ChatgptAuthTokensRefreshResponse = serde_json::from_value(result)
.map_err(|_| std::io::Error::other("invalid auth refresh response"))?;
let auth = CodexAuth::from_external_chatgpt_tokens(
response.access_token.as_str(),
response.chatgpt_account_id.as_str(),
response.chatgpt_plan_type.as_deref(),
)
.map_err(|err| {
std::io::Error::new(err.kind(), "auth refresh returned invalid credentials")
})?;
*self
.auth
.write()
.map_err(|_| std::io::Error::other("external auth lock is poisoned"))? = auth.clone();
Ok(auth)
}
}
impl ExternalAuth for ExternalAuthBridge {
fn resolve(&self) -> ExternalAuthFuture<'_, CodexAuth> {
Box::pin(async {
self.auth
.read()
.map(|auth| auth.clone())
.map_err(|_| std::io::Error::other("external auth lock is poisoned"))
})
}View on GitHub (pinned to 339751715c)
When it happens
Trigger: Thrown at codex-rs/app-server/src/external_auth.rs:75 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/4ff79cfc2e9b451a.
Report an issue: GitHub.