{"record":{"id":"2848f6d58926f5d3","repo":"zed-industries/zed","slug":"cannot-authorize-network-access-to-host-erro","errorCode":null,"errorMessage":"cannot authorize network access to {host:?}: {error}","messagePattern":"cannot authorize network access to (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/tools/fetch_tool.rs","lineNumber":210,"sourceCode":"}\n\n/// Extracts the host from a fetch URL as a [`http_proxy::HostPattern`] so it can\n/// be matched against the shared network grants. Mirrors the scheme handling in\n/// [`normalize_url`] (defaulting to `https://` when none is given).\nfn host_pattern_for_url(url: &str) -> Result<http_proxy::HostPattern> {\n    let normalized = normalize_url(url);\n    let parsed =\n        url::Url::parse(&normalized).with_context(|| format!(\"could not parse URL {url:?}\"))?;\n    let host = parsed\n        .host_str()\n        .with_context(|| format!(\"URL {url:?} has no host to authorize network access for\"))?;\n    http_proxy::HostPattern::parse(host).map_err(|error| match error {\n        http_proxy::HostPatternError::IpLiteral(_) => anyhow::anyhow!(\n            \"cannot fetch {host:?}: loopback and IP-literal hosts can't be granted network \\\n             access individually. They are only reachable once unsandboxed access has been \\\n             granted (for example, via a terminal command that requests it).\"\n        ),\n        error => anyhow::anyhow!(\"cannot authorize network access to {host:?}: {error}\"),\n    })\n}\n\nimpl AgentTool for FetchTool {\n    type Input = FetchToolInput;\n    type Output = String;\n\n    const NAME: &'static str = \"fetch\";\n\n    fn kind() -> acp::ToolKind {\n        acp::ToolKind::Fetch\n    }\n\n    fn allow_in_restricted_mode() -> bool {\n        false\n    }\n\n    fn initial_title(","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/agent/src/tools/fetch_tool.rs#L192-L228","documentation":"Raised when asking the network-access grant layer whether the fetch tool may contact the URL's host: the authorization lookup itself returned an error ({error}). The host extracted from the URL is shown; the fetch never starts because permission could not be established.","triggerScenarios":"Thrown at crates/agent/src/tools/fetch_tool.rs:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Host resolution or grant recording for the host failed (message includes the underlying error); check DNS/network availability","Re-attempt authorization after fixing the underlying cause, or run unsandboxed with user approval","Verify the host pattern derived from the URL is valid for the http proxy grant system"],"exampleFix":null,"handlingStrategy":"fallback","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-23T08:17:48.524Z"}