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
The AWC client `Connector::max_http_version()` only accepts `HTTP_11` or `HTTP_2`. At awc/src/client/connector.rs:336-343 any other `http::Version` (e.g. `HTTP_09`, `HTTP_10`, `HTTP_3`) hits `unimplemented!()` and panics during connector construction. This is a builder-time panic, so it typically crashes at startup.
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 937960ca67)
Solutions
- Use `http::Version::HTTP_11` (HTTP/1.1 only) or `http::Version::HTTP_2` (HTTP/2 with HTTP/1.1 fallback).
- If you need HTTP/3, note that AWC does not support it; choose a different client crate.
Example fix
// before
let connector = Connector::new()
.max_http_version(http::Version::HTTP_10);
// after
let connector = Connector::new()
.max_http_version(http::Version::HTTP_2); Defensive patterns
Strategy: validation
Validate before calling
// Guard before calling max_http_version.
fn assert_supported_version(v: http::Version) {
assert!(
matches!(v, http::Version::HTTP_11 | http::Version::HTTP_2),
"AWC only supports HTTP/1.1 and HTTP/2"
);
}
// assert_supported_version(http::Version::HTTP_2); Type guard
fn is_supported_version(v: http::Version) -> bool {
matches!(v, http::Version::HTTP_11 | http::Version::HTTP_2)
} Prevention
- Only pass HTTP_11 or HTTP_2 to max_http_version.
- Remember AWC has no HTTP/3 support.
When it happens
Trigger: Calling `.max_http_version(http::Version::HTTP_10)` or `HTTP_3` on a client `Connector`.
Common situations: Assuming the client supports HTTP/1.0 or HTTP/3, or passing a version constant by mistake.
Related errors
- All default headers must be added before cloning.
- Unsupported HTTP version: {:?}.
- Invalid header name
- Invalid header value
- cannot reuse response builder
AI-assisted analysis of actix/actix-web@937960ca67 (2026-08-06).
Data as JSON: /data/errors/0f4d534b6d2e1518.json.
Report an issue: GitHub.