openai/codex · error · TransportError
http
Error message
http {status}: {body:?} What it means
A non-success HTTP response was returned by the remote server. This Http variant of TransportError carries the status code plus optional url, headers, and body captured from the response; it fires whenever the transport finishes a request with a 4xx/5xx status and callers are expected to branch on `status` to decide between retry, auth refresh, or surfacing the failure.
Solutions
- Branch on the status code: retry idempotent requests on 408/429/5xx with backoff, honor Retry-After when present
- For 401/403, refresh credentials or API keys before retrying
- For other 4xx, inspect the captured body/headers for the API-specific error details and fix the request
- Log url and headers (minus secrets) to correlate with server-side failures
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/http-client/src/error.rs:10 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/270c48b233eeccf5.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/http-client/src/error.rs:10
//! Errors returned by the shared Codex HTTP transport.
use crate::client::HttpError;
use http::HeaderMap;
use http::StatusCode;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum TransportError {
#[error("http {status}: {body:?}")]
Http {
status: StatusCode,
url: Option<String>,
headers: Option<HeaderMap>,
body: Option<String>,
},
#[error("retry limit reached")]
RetryLimit,
#[error("timeout")]
Timeout,
#[error("connection failed: {0}")]
Connection(#[source] HttpError),
#[error("network error: {0}")]
Network(String),
#[error("request build error: {0}")]
Build(String),
}
View on GitHub (pinned to 339751715c)