{"record":{"id":"3f1e9af595604a1a","repo":"zed-industries/zed","slug":"upstream-proxy-url-url-must-include-a-port","errorCode":null,"errorMessage":"upstream proxy url '{url}' must include a port","messagePattern":"upstream proxy url '(.+?)' must include a port","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/http_proxy/src/proxy/upstream.rs","lineNumber":150,"sourceCode":"        }\n\n        let host = parsed\n            .host_str()\n            .ok_or_else(|| anyhow!(\"upstream proxy url '{url}' has no host\"))?;\n        // Brackets around IPv6 literals are URL syntax, not part of the\n        // address; strip them so the host can be handed to\n        // `ToSocketAddrs` (which rejects bracketed forms).\n        let host = host\n            .strip_prefix('[')\n            .and_then(|stripped| stripped.strip_suffix(']'))\n            .unwrap_or(host)\n            .to_string();\n        // `Url::port` elides scheme-default ports, so a plain `.port()`\n        // can't distinguish `http://proxy:80` from `http://proxy`; treat\n        // both as port 80.\n        let port = parsed\n            .port_or_known_default()\n            .ok_or_else(|| anyhow!(\"upstream proxy url '{url}' must include a port\"))?;\n\n        let auth = if parsed.username().is_empty() {\n            None\n        } else {\n            Some(UpstreamAuth {\n                // `Url` returns percent-encoded credentials; decode for the\n                // wire `Basic` token, which expects the raw `user:pass`.\n                user: percent_decode(parsed.username()),\n                password: percent_decode(parsed.password().unwrap_or(\"\")),\n            })\n        };\n\n        Ok(Self {\n            host,\n            port,\n            auth,\n            no_proxy,\n        })","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/http_proxy/src/proxy/upstream.rs#L132-L168","documentation":"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.","triggerScenarios":"Thrown at crates/http_proxy/src/proxy/upstream.rs:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}