openai/codex · error · anyhow::Error
Request failed with status {status}: {body}
Error message
Request failed with status {status}: {body} What it means
Error "Request failed with status {status}: {body}" thrown in openai/codex.
Source
Thrown at codex-rs/chatgpt/src/chatgpt_client.rs:115
.headers(default_headers())
.headers(codex_model_provider::auth_provider_from_auth(&auth).to_auth_headers())
.header(OAI_PRODUCT_SKU_HEADER, CODEX_PRODUCT_SKU)
.header("Content-Type", "application/json");
if let Some(timeout) = timeout {
request = request.timeout(timeout);
}
let response = request.send().await.context("Failed to send request")?;
if response.status().is_success() {
let result: T = response
.json()
.await
.context("Failed to parse JSON response")?;
Ok(result)
} else {
let status = response.status();
let body = response.text().await.unwrap_or_default();
anyhow::bail!("Request failed with status {status}: {body}")
}
}
/// Make a POST request to the ChatGPT backend API with an already-captured auth identity.
///
/// Callers that bind other state to the auth snapshot should pass that same snapshot here rather
/// than reacquiring auth while the request is in flight.
pub(crate) async fn chatgpt_post_request_with_timeout<
TResponse: DeserializeOwned,
TRequest: Serialize + ?Sized,
>(
config: &Config,
auth: &CodexAuth,
path: String,
body: &TRequest,
timeout: Duration,
product_sku: &str,
) -> anyhow::Result<TResponse> {View on GitHub (pinned to 339751715c)
When it happens
Trigger: Thrown at codex-rs/chatgpt/src/chatgpt_client.rs:115 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/52b6ed41372fd97e.
Report an issue: GitHub.