zed-industries/zed · error

Failed to initialize HTTP client

Error message

Failed to initialize HTTP client

What it means

ReqwestClient::new failed to build the underlying reqwest client after applying keep-alive/timeout configuration — typically an invalid read_timeout value or reqwest builder error, meaning no HTTP client can be created in this process.

Source

Thrown at crates/reqwest_client/src/reqwest_client.rs:55

            // Detect and drop connections that have silently gone bad on a
            // flaky path (NAT timeouts, resets) instead of reusing them. A
            // stale reused HTTP/2 connection is a common source of
            // `BadRecordMac` TLS errors against long-lived endpoints.
            .tcp_keepalive(Duration::from_secs(30))
            .pool_idle_timeout(Duration::from_secs(30))
            .http2_keep_alive_interval(Duration::from_secs(15))
            .http2_keep_alive_timeout(Duration::from_secs(10))
            .http2_keep_alive_while_idle(true);
        match read_timeout {
            Some(read_timeout) => builder.read_timeout(read_timeout),
            None => builder,
        }
    }

    pub fn new() -> Self {
        Self::builder(None)
            .build()
            .expect("Failed to initialize HTTP client")
            .into()
    }

    pub fn user_agent(agent: &str) -> anyhow::Result<Self> {
        let mut map = HeaderMap::new();
        map.insert(http::header::USER_AGENT, HeaderValue::from_str(agent)?);
        let client = Self::builder(None).default_headers(map).build()?;
        Ok(client.into())
    }

    pub fn proxy_and_user_agent(proxy: Option<Url>, user_agent: &str) -> anyhow::Result<Self> {
        Self::proxy_user_agent_and_read_timeout(proxy, user_agent, None)
    }

    /// Like [`ReqwestClient::proxy_and_user_agent`], but also applies a
    /// per-read idle timeout. `read_timeout` fires only after that long with no
    /// bytes received on a response body and resets on every chunk, so it
    /// aborts a silently stalled stream without disturbing a healthy one that

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check read_timeout is a sane non-zero duration
  2. Log the underlying reqwest builder error
  3. Retry with default configuration if custom options fail
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/reqwest_client/src/reqwest_client.rs:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/272a6dad5c290cd1. Report an issue: GitHub.