vectordotdev/vector · info

Building request never fails.

Error message

Building request never fails.

What it means

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.

Solutions

  1. No user action required; this is unreachable on stock builds.
  2. If seen in a fork, restore the standard request-construction code in src/sinks/loki/healthcheck.rs.
  3. Update http/hyper crates to compatible versions when vendoring.
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: 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.

Common situations: Only conceivable with a patched http crate or heavily modified code around src/sinks/loki/healthcheck.rs; ordinary users will never see it.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/4d6b87a443764855. Report an issue: GitHub.

Appendix: source

Thrown at src/sinks/loki/healthcheck.rs:15

use super::append_loki_path;

use crate::{
    http::{Auth, HttpClient},
    sinks::util::{HttpEndpoint, UriSerde},
};

async fn fetch_status(
    endpoint: &http::Uri,
    auth: Option<&Auth>,
    client: &HttpClient,
) -> crate::Result<http::StatusCode> {
    let mut req = http::Request::get(endpoint)
        .body(hyper::Body::empty())
        .expect("Building request never fails.");

    if let Some(auth) = auth {
        auth.apply(&mut req);
    }

    Ok(client.send(req).await?.status())
}

pub async fn healthcheck(
    base_endpoint: HttpEndpoint,
    auth: Option<Auth>,
    healthcheck_uri: Option<UriSerde>,
    client: HttpClient,
) -> crate::Result<()> {
    // Healthcheck URI has been explicitly configured
    if let Some(uri) = healthcheck_uri {
        let auth = uri.auth.or(auth);
        let status = fetch_status(&uri.uri, auth.as_ref(), &client).await?;

View on GitHub (pinned to bdb87aeaa4)