{"id":"568bf886ce9fa855","repo":"seanmonstar/reqwest","slug":"error-sending-request-568bf8","errorCode":null,"errorMessage":"error sending request","messagePattern":"error sending request","errorType":"exception","errorClass":"reqwest::Error","httpStatus":null,"severity":"error","filePath":"src/async_impl/h3_client/pool.rs","lineNumber":383,"sourceCode":"    let uri_clone = uri.clone();\n    match (uri_clone.scheme(), uri_clone.authority()) {\n        (Some(scheme), Some(auth)) => {\n            let scheme_str = scheme.as_str();\n            if scheme_str != \"https\" && scheme_str != \"h3\" {\n                return Err(Error::new(\n                    Kind::Request,\n                    Some(Box::new(std::io::Error::new(\n                        std::io::ErrorKind::InvalidInput,\n                        format!(\n                            \"HTTP/3 only supports 'https' or 'h3' schemes, got: {}\",\n                            scheme_str\n                        ),\n                    ))),\n                ));\n            }\n            Ok((scheme.clone(), auth.clone()))\n        }\n        _ => Err(Error::new(Kind::Request, None::<Error>)),\n    }\n}\n\npub(crate) fn domain_as_uri((scheme, auth): Key) -> Uri {\n    http::uri::Builder::new()\n        .scheme(scheme)\n        .authority(auth)\n        .path_and_query(\"/\")\n        .build()\n        .expect(\"domain is valid Uri\")\n}\n\n/// Indicates the remote requested the peer to stop sending data without error.\nfn is_stop_sending(e: &h3::error::StreamError) -> bool {\n    matches!(\n        e,\n        h3::error::StreamError::RemoteTerminate {\n            code: h3::error::Code::H3_NO_ERROR,","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/seanmonstar/reqwest/blob/17e9bcb51c46edebfb6f5f2f5184b51dac4b3a7d/src/async_impl/h3_client/pool.rs#L365-L401","documentation":"Returned by `extract_domain` (pool.rs:383) in the fallthrough arm where the URI has no scheme and/or no authority (host). It is a `Kind::Request` error with no inner source, meaning the request URI was structurally incomplete for forming an HTTP/3 connection key.","triggerScenarios":"Dispatching a request through the HTTP/3 client with a relative URI (`/path`), a URI with no host (`http:///path`), or a manually built `http::Request` whose `Uri` lacks scheme/authority.","commonSituations":"Building a request with `Request::builder().uri(\"/users\")` and sending through h3; URL rewrite stripping the host; proxy/forwarder constructing URIs without the origin.","solutions":["Ensure the request URI is absolute with scheme and authority, e.g. `https://host/path`, before sending through the HTTP/3 client.","Let reqwest parse the URL via `IntoUrl` rather than constructing the `Uri` by hand.","Check `req.uri().authority().is_some()` and `.scheme().is_some()` before dispatch."],"exampleFix":"// before\nlet req = Request::builder()\n    .uri(\"/api/v1/users\")          // no scheme/host\n    .body(Body::empty())?;\n\n// after\nlet req = Request::builder()\n    .uri(\"https://api.example.com/api/v1/users\")\n    .body(Body::empty())?;","handlingStrategy":"validation","validationCode":"fn uri_has_origin(u: &http::Uri) -> bool {\n    u.scheme().is_some() && u.authority().is_some()\n}\nassert!(uri_has_origin(req.uri()), \"URI must be absolute with scheme+authority\");\n","typeGuard":"fn is_originless_uri(e: &reqwest::Error) -> bool {\n    e.is_request() && e.source().is_none()\n}\n","tryCatchPattern":"let r = h3_client.request(req).await.map_err(|e| {\n    if is_originless_uri(&e) { anyhow!(\"request URI needs scheme+host\") } else { e.into() }\n})?;","preventionTips":["Always send absolute URIs through the h3 client.","Build requests from a base URL + relative path so the host is never lost."],"tags":["http3","url","request","validation"],"analyzedSha":"17e9bcb51c46edebfb6f5f2f5184b51dac4b3a7d","analyzedAt":"2026-08-06T01:23:05.134Z","schemaVersion":2}