openai/codex · error
failed: ; content-type= ; body=
Error message
{method} {url} failed: {status}; content-type={ct}; body={body} What it means
Bail-out in the request helper after a non-success HTTP response: the method, URL, status code, content-type, and full body of the failed backend call are packed into one anyhow error so callers can diagnose the exact failing request. It fires for any non-2xx from exec_request-based calls.
Solutions
- Parse the embedded status/body: fix the request for 4xx, retry with backoff for 5xx
- Ensure auth headers and request payloads are correct so the backend accepts the call
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/backend-client/src/client.rs:268 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/7b2b5c9131998864.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/backend-client/src/client.rs:268
}
async fn exec_request(
&self,
req: RouteAwareRequestBuilder,
method: &str,
url: &str,
) -> Result<(String, String)> {
let res = req.send().await?;
let status = res.status();
let ct = res
.headers()
.get(CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.unwrap_or("")
.to_string();
let body = res.text().await.unwrap_or_default();
if !status.is_success() {
anyhow::bail!("{method} {url} failed: {status}; content-type={ct}; body={body}");
}
Ok((body, ct))
}
async fn exec_request_detailed(
&self,
req: RouteAwareRequestBuilder,
method: &str,
url: &str,
) -> std::result::Result<(String, String), RequestError> {
let res = req.send().await.map_err(anyhow::Error::from)?;
let status = res.status();
let content_type = res
.headers()
.get(CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.unwrap_or("")
.to_string();View on GitHub (pinned to 339751715c)