zed-industries/zed · error

cannot authorize network access to

Error message

cannot authorize network access to {host:?}: {error}

What it means

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.

Solutions

  1. Host resolution or grant recording for the host failed (message includes the underlying error); check DNS/network availability
  2. Re-attempt authorization after fixing the underlying cause, or run unsandboxed with user approval
  3. Verify the host pattern derived from the URL is valid for the http proxy grant system
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/agent/src/tools/fetch_tool.rs:210 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/2848f6d58926f5d3. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent/src/tools/fetch_tool.rs:210

}

/// Extracts the host from a fetch URL as a [`http_proxy::HostPattern`] so it can
/// be matched against the shared network grants. Mirrors the scheme handling in
/// [`normalize_url`] (defaulting to `https://` when none is given).
fn host_pattern_for_url(url: &str) -> Result<http_proxy::HostPattern> {
    let normalized = normalize_url(url);
    let parsed =
        url::Url::parse(&normalized).with_context(|| format!("could not parse URL {url:?}"))?;
    let host = parsed
        .host_str()
        .with_context(|| format!("URL {url:?} has no host to authorize network access for"))?;
    http_proxy::HostPattern::parse(host).map_err(|error| match error {
        http_proxy::HostPatternError::IpLiteral(_) => anyhow::anyhow!(
            "cannot fetch {host:?}: loopback and IP-literal hosts can't be granted network \
             access individually. They are only reachable once unsandboxed access has been \
             granted (for example, via a terminal command that requests it)."
        ),
        error => anyhow::anyhow!("cannot authorize network access to {host:?}: {error}"),
    })
}

impl AgentTool for FetchTool {
    type Input = FetchToolInput;
    type Output = String;

    const NAME: &'static str = "fetch";

    fn kind() -> acp::ToolKind {
        acp::ToolKind::Fetch
    }

    fn allow_in_restricted_mode() -> bool {
        false
    }

    fn initial_title(

View on GitHub (pinned to f4178619ac)