{"record":{"id":"97b9c07d7c9a861c","repo":"openai/codex","slug":"timeout","errorCode":null,"errorMessage":"timeout","messagePattern":"timeout","errorType":"exception","errorClass":"TransportError","httpStatus":null,"severity":"error","filePath":"codex-rs/http-client/src/error.rs","lineNumber":19,"sourceCode":"//! Errors returned by the shared Codex HTTP transport.\n\nuse crate::client::HttpError;\nuse http::HeaderMap;\nuse http::StatusCode;\nuse thiserror::Error;\n\n#[derive(Debug, Error)]\npub enum TransportError {\n    #[error(\"http {status}: {body:?}\")]\n    Http {\n        status: StatusCode,\n        url: Option<String>,\n        headers: Option<HeaderMap>,\n        body: Option<String>,\n    },\n    #[error(\"retry limit reached\")]\n    RetryLimit,\n    #[error(\"timeout\")]\n    Timeout,\n    #[error(\"connection failed: {0}\")]\n    Connection(#[source] HttpError),\n    #[error(\"network error: {0}\")]\n    Network(String),\n    #[error(\"request build error: {0}\")]\n    Build(String),\n}\n\n#[derive(Debug, Error)]\npub enum StreamError {\n    #[error(\"stream failed: {0}\")]\n    Stream(String),\n    #[error(\"timeout\")]\n    Timeout,\n}\n","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/http-client/src/error.rs#L1-L36","documentation":"TransportError::Timeout is returned by the shared Codex HTTP transport (ReqwestTransport::execute / stream) when the underlying reqwest error reports is_timeout(). It is produced by map_error in codex-rs/http-client/src/transport.rs:80-88 and covers the initial send, the buffered body read (resp.bytes()), and every item of the byte stream. The variant carries no context (no URL, no elapsed time), so correlate it with your own request logging.","triggerScenarios":"Calling HttpTransport::execute or HttpTransport::stream on a Request whose timeout field is Some(Duration) (applied at transport.rs:69-71), or a client built with a connect timeout, where reqwest reports is_timeout(): the per-request deadline elapsed during connect, send, or response-body read.","commonSituations":"Aggressive per-request timeouts against slow streaming/LLM endpoints, connect timeouts through corporate proxies, servers that accept the connection but stall before responding, high-latency CI or mobile networks.","solutions":["Raise the per-request deadline (Request.timeout) to match the endpoint's worst-case response time","For streaming endpoints use HttpTransport::stream instead of buffered execute, and bound only connection setup via HttpClientBuilder::connect_timeout instead of a whole-request timeout","Verify the endpoint actually responds within the budget (curl the same URL) and check for proxy-added latency","Retry with capped backoff and jitter: timeouts are frequently transient"],"exampleFix":"// before\nlet request = Request {\n    timeout: Some(Duration::from_secs(5)),\n    ..req\n};\ntransport.execute(request).await?; // TransportError::Timeout on slow endpoints\n\n// after: size the deadline to the endpoint, or bound only the connect phase\nlet request = Request {\n    timeout: Some(Duration::from_secs(120)),\n    ..req\n};\n// connect-only bound: build the client with HttpClientBuilder::connect_timeout(...)","handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_transport_timeout(e: &TransportError) -> bool {\n    matches!(e, TransportError::Timeout)\n}","tryCatchPattern":"match transport.execute(req).await {\n    Err(TransportError::Timeout) => retry_with_jitter(req, MAX_ATTEMPTS).await,\n    Err(TransportError::Connection(source)) => /* classify via source, maybe retry */,\n    Err(TransportError::Http { status, .. }) if status.is_server_error() => /* retry */,\n    other => other,\n}","preventionTips":["Size per-request timeouts from measured endpoint p99 latency, not defaults","Use connect-only bounds (HttpClientBuilder::connect_timeout) for streaming paths so slow bodies are not cut off","Add a deadline budget that subtracts elapsed time before each retry","Alert on timeout rate per destination to catch slow degradation early"],"tags":["network","timeout","http","rust"],"backgroundTag":"request-timeout","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}