zed-industries/zed · error
upstream proxy url '{url}' must include a port
Error message
upstream proxy url '{url}' must include a port What it means
Validation guard in parse_url: the upstream proxy URL parsed successfully and has a host, but `Url::port_or_known_default()` returned None, so no port could be determined for the connection. The upstream proxy is dialed as a raw host:port socket, so an explicit port is required; a scheme the code doesn't know a default port for (it accepts only http, which normally defaults to 80) that still lacks a port triggers this.
Source
Thrown at crates/http_proxy/src/proxy/upstream.rs:150
}
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 {
Some(UpstreamAuth {
// `Url` returns percent-encoded credentials; decode for the
// wire `Basic` token, which expects the raw `user:pass`.
user: percent_decode(parsed.username()),
password: percent_decode(parsed.password().unwrap_or("")),
})
};
Ok(Self {
host,
port,
auth,
no_proxy,
})View on GitHub (pinned to f4178619ac)
Solutions
- Add an explicit port to the proxy URL, e.g. http://proxy.example.com:8080 instead of http://proxy.example.com
- Use the standard http:// scheme so port 80 is assumed as the known default
- Check the proxy configuration source (env var or settings) for a truncated URL
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/http_proxy/src/proxy/upstream.rs:150 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/3f1e9af595604a1a.
Report an issue: GitHub.