vectordotdev/vector · error

a validated HTTP endpoint is a valid `http 1` URI

Error message

a validated HTTP endpoint is a valid `http 1` URI

What it means

into_v1 converts a validated HTTP/0.2-style endpoint (hyper Uri) into an http 1.x Uri by parsing its string form. The expect documents the invariant: an endpoint accepted by the protocol_endpoint validation parses cleanly under both URI grammars, so failure indicates the validation invariant was violated (or the endpoint was constructed without validation).

Solutions

  1. Always create the Endpoint via protocol_endpoint (the validating constructor) instead of building it manually.
  2. Verify the configured address is a normal http/https URL with host (no exotic forms) before building the sink.
  3. If a legitimate URI fails, replace the expect with a config-time error and report the endpoint string.

Example fix

// before
self.0.to_string().parse().expect("a validated HTTP endpoint is a valid `http 1` URI")
// after
self.0
    .to_string()
    .parse()
    .map_err(|e| crate::Error::from(format!("endpoint {:?} is not a valid http 1 URI: {}", self.0, e)))?
Defensive patterns

Strategy: validation

Validate before calling

// build endpoints only through the validating constructor
let endpoint = protocol_endpoint(scheme, &address)?;

Try / catch

self.0.to_string().parse::<http_1::Uri>().map_err(|e| crate::Error::from(...))?

Prevention

When it happens

Trigger: Calling into_v1 on an Endpoint that was never passed through protocol_endpoint validation, or whose string form is no longer a valid http 1 URI (e.g. forged/modified internal state) — hit from the healthcheck path.

Common situations: Custom or newly added sink code constructing Endpoint values directly rather than via the validating constructor; a change in the http crate introducing stricter v1 URI parsing.

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/5d394ef19240925c. Report an issue: GitHub.

Appendix: source

Thrown at src/sinks/util/uri.rs:405

    }

    /// Consumes the endpoint, returning the underlying `Uri`.
    pub fn into_uri(self) -> Uri {
        self.0
    }

    /// Consumes the endpoint, returning the underlying `Uri` as an `http 1` `Uri`.
    ///
    /// The two `http` crate versions share no conversion traits, so the bridge
    /// is a string round-trip. `Display` of a validated absolute `http(s)` URL
    /// is always parseable back by `http 1` (the `http 1` parser descends from
    /// the `http 0.2` parser and accepts the same absolute forms), so this
    /// cannot fail — the same invariant `protocol_endpoint` relies on.
    pub fn into_v1(self) -> http_1::Uri {
        self.0
            .to_string()
            .parse()
            .expect("a validated HTTP endpoint is a valid `http 1` URI")
    }

    /// Extracts basic-auth credentials embedded in the authority, returning a
    /// credential-free endpoint alongside the credentials.
    pub fn extract_basic_auth(self) -> crate::Result<(Self, Option<Auth>)> {
        if !self
            .as_uri()
            .authority()
            .is_some_and(|authority| authority.as_str().contains('@'))
        {
            return Ok((self, None));
        }

        let UriSerde { uri, auth } = self.into_uri().try_into()?;
        Ok((Self::new(uri)?, auth))
    }

    /// Returns the URL scheme (`http` or `https`) of this endpoint.

View on GitHub (pinned to bdb87aeaa4)