actix/actix-web · critical

actix-http client only supports versions http/1.1 & http/2

Error message

actix-http client only supports versions http/1.1 & http/2

What it means

This is a runtime panic (via `unimplemented!`) that occurs when `Connector::max_http_version()` is called with an HTTP version other than HTTP/1.1 or HTTP/2. The match at line 337-343 only handles `HTTP_11` and `HTTP_2`; any other variant falls into the wildcard arm and panics. The awc client connector does not support HTTP/3 or other protocol versions.

Solutions

  1. Use `http::Version::HTTP_2` for HTTP/2 with ALPN upgrade, or `http::Version::HTTP_11` for HTTP/1.1 only
  2. HTTP/3 is not supported; do not pass `HTTP_3` to `max_http_version`
  3. Remove the `.max_http_version(...)` call entirely if you want the default (which supports both HTTP/1.1 and HTTP/2)

Example fix

// before
let connector = awc::Connector::new()
    .max_http_version(http::Version::HTTP_3)
    .finish();

// after
let connector = awc::Connector::new()
    .max_http_version(http::Version::HTTP_2)
    .finish();
Defensive patterns

Strategy: validation

Validate before calling

// Before calling max_http_version, verify the version is supported.
fn build_connector(version: http::Version) -> Result<awc::Connector<...>, &'static str> {
    match version {
        http::Version::HTTP_11 | http::Version::HTTP_2 => {
            Ok(awc::Connector::new().max_http_version(version).finish())
        }
        _ => Err("awc only supports HTTP/1.1 and HTTP/2"),
    }
}

Type guard

fn is_supported_version(v: http::Version) -> bool {
    matches!(v, http::Version::HTTP_11 | http::Version::HTTP_2)
}

Try / catch

// Avoid calling max_http_version with unsupported versions.
// The default connector already supports both HTTP/1.1 and HTTP/2.
// Only call max_http_version if you need to restrict to one version.
// Do not wrap in try-catch; this is unimplemented!() and cannot be caught in Rust.

Prevention

When it happens

Trigger: Calling `Connector::new().max_http_version(http::Version::HTTP_3)` or `max_http_version(http::Version::HTTP_09)` or `max_http_version(http::Version::HTTP_10)`. Any `http::Version` variant besides `HTTP_11` and `HTTP_2` triggers the panic.

Common situations: Developers who try to enable HTTP/3 support (not yet implemented), or who accidentally pass `HTTP_10` thinking it will enable HTTP/1.0 (use `HTTP_11` instead). Misuse of the `http` crate's version constants.

Related errors


AI-assisted analysis of actix/actix-web@4d435abc28 (2026-08-09). Data as JSON: /api/errors/0f4d534b6d2e1518. Report an issue: GitHub.

Appendix: source

Thrown at awc/src/client/connector.rs:341

    /// ```
    #[cfg(feature = "rustls-0_23")]
    pub fn rustls_0_23(
        mut self,
        connector: std::sync::Arc<actix_tls::connect::rustls_0_23::reexports::ClientConfig>,
    ) -> Self {
        self.tls = OurTlsConnector::Rustls023(connector);
        self
    }

    /// Sets maximum supported HTTP major version.
    ///
    /// Supported versions are HTTP/1.1 and HTTP/2.
    pub fn max_http_version(mut self, val: http::Version) -> Self {
        let versions = match val {
            http::Version::HTTP_11 => vec![b"http/1.1".to_vec()],
            http::Version::HTTP_2 => vec![b"h2".to_vec(), b"http/1.1".to_vec()],
            _ => {
                unimplemented!("actix-http client only supports versions http/1.1 & http/2")
            }
        };
        self.tls = Connector::build_tls(versions);
        self
    }

    /// Sets the initial window size (in bytes) for HTTP/2 stream-level flow control for received
    /// data.
    ///
    /// The default value is 65,535 and is good for APIs, but not for big objects.
    pub fn initial_window_size(mut self, size: u32) -> Self {
        self.config.stream_window_size = size;
        self
    }

    /// Sets the initial window size (in bytes) for HTTP/2 connection-level flow control for
    /// received data.
    ///

View on GitHub (pinned to 4d435abc28)