zed-industries/zed · error

upstream proxy url '{url}' has no host

Error message

upstream proxy url '{url}' has no host

What it means

Validation guard in parse_url of the upstream proxy configuration: after parsing the (scheme-normalized) proxy URL, `Url::host_str()` returned None, meaning the configured proxy string had no host component. A proxy URL like "http:///path" or an otherwise malformed value cannot be used to open a connection, so parsing fails.

Source

Thrown at crates/http_proxy/src/proxy/upstream.rs:136

        let normalized = if url.contains("://") {
            url.to_string()
        } else {
            format!("http://{url}")
        };

        let parsed = Url::parse(&normalized)
            .with_context(|| format!("parsing upstream proxy url '{url}'"))?;

        if parsed.scheme() != "http" {
            bail!(
                "unsupported upstream proxy scheme '{}://' in '{url}': only http:// is supported",
                parsed.scheme()
            );
        }

        let host = parsed
            .host_str()
            .ok_or_else(|| anyhow!("upstream proxy url '{url}' has no host"))?;
        // Brackets around IPv6 literals are URL syntax, not part of the
        // address; strip them so the host can be handed to
        // `ToSocketAddrs` (which rejects bracketed forms).
        let host = host
            .strip_prefix('[')
            .and_then(|stripped| stripped.strip_suffix(']'))
            .unwrap_or(host)
            .to_string();
        // `Url::port` elides scheme-default ports, so a plain `.port()`
        // can't distinguish `http://proxy:80` from `http://proxy`; treat
        // both as port 80.
        let port = parsed
            .port_or_known_default()
            .ok_or_else(|| anyhow!("upstream proxy url '{url}' must include a port"))?;

        let auth = if parsed.username().is_empty() {
            None
        } else {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Fix the proxy environment variable (HTTP_PROXY/HTTPS_PROXY/ALL_PROXY) or setting so it includes a host, e.g. http://proxy.example.com:8080
  2. Ensure the value isn't just a scheme or path with the host missing
  3. Check for stray characters or truncation when the variable was exported
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/http_proxy/src/proxy/upstream.rs:136 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/f86bbcf817430a5e. Report an issue: GitHub.