zed-industries/zed · error

failed to build commit permalink

Error message

failed to build commit permalink

What it means

A URL-construction guard in the Azure DevOps provider: build_commit_permalink joins '{owner}/_git/{repo}/commit/{sha}' onto the configured base_url and expects Url::join to succeed. join fails when the base URL cannot be a base (e.g. a malformed or non-hierarchical base) or the joined segments make the result invalid — so the inputs at fault are the provider's base_url plus owner/repo/sha strings containing characters that break URL parsing (spaces, control chars, '/').

Source

Thrown at crates/git_hosting_providers/src/providers/azure.rs:128

    fn parse_remote_url(&self, url: &str) -> Option<ParsedGitRemote> {
        let url = RemoteUrl::from_str(url).ok()?;

        self.parse_dev_azure_com_url(&url)
            .or_else(|| self.parse_visualstudio_com_url(&url))
    }

    fn build_commit_permalink(
        &self,
        remote: &ParsedGitRemote,
        params: BuildCommitPermalinkParams,
    ) -> Url {
        let BuildCommitPermalinkParams { sha } = params;
        let ParsedGitRemote { owner, repo } = remote;

        let mut url = self
            .base_url()
            .join(&format!("{owner}/_git/{repo}/commit/{sha}"))
            .expect("failed to build commit permalink");
        url.set_query(None);
        url
    }

    fn build_permalink(&self, remote: ParsedGitRemote, params: BuildPermalinkParams) -> Url {
        let ParsedGitRemote { owner, repo } = remote;
        let BuildPermalinkParams {
            sha,
            path,
            selection,
        } = params;

        let mut permalink = self
            .base_url()
            .join(&format!("{owner}/_git/{repo}"))
            .expect("failed to build permalink");

        let mut query = format!("path=/{path}&version=GC{sha}");

View on GitHub (pinned to f4178619ac)

Solutions

  1. Return Option<Url> (or Result) from build_commit_permalink and let callers skip permalinks that cannot be built
  2. Percent-encode owner/repo/sha segments with urlencoding before joining
  3. Validate the base_url is a valid hierarchical URL when the provider is constructed
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/git_hosting_providers/src/providers/azure.rs:128 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/40b926b38df7d49b. Report an issue: GitHub.