{"record":{"id":"63f167e126288d55","repo":"zed-industries/zed","slug":"failed-to-build-permalink","errorCode":null,"errorMessage":"failed to build permalink","messagePattern":"failed to build permalink","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git_hosting_providers/src/providers/azure.rs","lineNumber":144,"sourceCode":"            .base_url()\n            .join(&format!(\"{owner}/_git/{repo}/commit/{sha}\"))\n            .expect(\"failed to build commit permalink\");\n        url.set_query(None);\n        url\n    }\n\n    fn build_permalink(&self, remote: ParsedGitRemote, params: BuildPermalinkParams) -> Url {\n        let ParsedGitRemote { owner, repo } = remote;\n        let BuildPermalinkParams {\n            sha,\n            path,\n            selection,\n        } = params;\n\n        let mut permalink = self\n            .base_url()\n            .join(&format!(\"{owner}/_git/{repo}\"))\n            .expect(\"failed to build permalink\");\n\n        let mut query = format!(\"path=/{path}&version=GC{sha}\");\n        if let Some(selection) = selection {\n            query.push('&');\n            query.push_str(&self.line_fragment(&selection));\n        }\n        permalink.set_query(Some(&query));\n\n        permalink\n    }\n\n    fn build_create_pull_request_url(\n        &self,\n        remote: &ParsedGitRemote,\n        source_branch: &str,\n    ) -> Option<Url> {\n        let ParsedGitRemote { owner, repo } = remote;\n        let encoded_source = urlencoding::encode(source_branch);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/git_hosting_providers/src/providers/azure.rs#L126-L162","documentation":"A URL-construction guard in build_permalink: it joins '{owner}/_git/{repo}' (plus optional path/selection query parameters) onto the Azure base_url and panics via expect if Url::join produces an error. As with the commit permalink, this fires when the base URL is not a valid base or the owner/repo/path components contain characters that cannot form a valid URL, e.g. a repo name with a space or an empty owner.","triggerScenarios":"Thrown at crates/git_hosting_providers/src/providers/azure.rs:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the permalink builders' contract to return Option/Result and degrade to no link when construction fails","URL-encode each dynamic path segment before formatting it into the join string","Reject or normalize malformed remote URLs earlier, when ParsedGitRemote is produced"],"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-14T05:17:10.506Z"}