{"record":{"id":"4d6b87a443764855","repo":"vectordotdev/vector","slug":"building-request-never-fails","errorCode":null,"errorMessage":"Building request never fails.","messagePattern":"Building request never fails\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/sinks/loki/healthcheck.rs","lineNumber":15,"sourceCode":"use super::append_loki_path;\n\nuse crate::{\n    http::{Auth, HttpClient},\n    sinks::util::{HttpEndpoint, UriSerde},\n};\n\nasync fn fetch_status(\n    endpoint: &http::Uri,\n    auth: Option<&Auth>,\n    client: &HttpClient,\n) -> crate::Result<http::StatusCode> {\n    let mut req = http::Request::get(endpoint)\n        .body(hyper::Body::empty())\n        .expect(\"Building request never fails.\");\n\n    if let Some(auth) = auth {\n        auth.apply(&mut req);\n    }\n\n    Ok(client.send(req).await?.status())\n}\n\npub async fn healthcheck(\n    base_endpoint: HttpEndpoint,\n    auth: Option<Auth>,\n    healthcheck_uri: Option<UriSerde>,\n    client: HttpClient,\n) -> crate::Result<()> {\n    // Healthcheck URI has been explicitly configured\n    if let Some(uri) = healthcheck_uri {\n        let auth = uri.auth.or(auth);\n        let status = fetch_status(&uri.uri, auth.as_ref(), &client).await?;","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sinks/loki/healthcheck.rs#L1-L33","documentation":"The Loki healthcheck builds a trivial GET request with an empty body via http::Request::get(...).body(...) and unwraps with expect, since constructing a GET with no body can never fail. The panic exists only to convert a Result into a value; it fires only if the http crate rejects request construction, which for this call shape is impossible.","triggerScenarios":"healthcheck()/fetch_status() is called and http::Request::get(endpoint).body(Body::empty()) returns Err — not reachable with a valid Uri and empty body on any hyper/http version in use.","commonSituations":"Only conceivable with a patched http crate or heavily modified code around src/sinks/loki/healthcheck.rs; ordinary users will never see it.","solutions":["No user action required; this is unreachable on stock builds.","If seen in a fork, restore the standard request-construction code in src/sinks/loki/healthcheck.rs.","Update http/hyper crates to compatible versions when vendoring."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["No action needed — unreachable on stock builds.","Keep http/hyper versions consistent when vendoring."],"tags":["rust","panic","http","loki","healthcheck"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}