{"record":{"id":"9de7d20fd3e569e7","repo":"FuelLabs/sway","slug":"error","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-pkg/src/source/git/mod.rs","lineNumber":273,"sourceCode":"    }\n}\n\nimpl fmt::Display for Reference {\n    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {\n        match self {\n            Reference::Branch(ref s) => write!(f, \"branch={s}\"),\n            Reference::Tag(ref s) => write!(f, \"tag={s}\"),\n            Reference::Rev(ref _s) => write!(f, \"rev\"),\n            Reference::DefaultBranch => write!(f, \"default-branch\"),\n        }\n    }\n}\n\nimpl FromStr for Url {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {\n        let url = gix_url::Url::from_bytes(s.as_bytes().into()).map_err(|e| anyhow!(\"{}\", e))?;\n        Ok(Self { url })\n    }\n}\n\nimpl FromStr for Pinned {\n    type Err = PinnedParseError;\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        // git+<url/to/repo>?<reference>#<commit>\n        let s = s.trim();\n\n        // Check for \"git+\" at the start.\n        let prefix_plus = format!(\"{}+\", Self::PREFIX);\n        if s.find(&prefix_plus) != Some(0) {\n            return Err(PinnedParseError::Prefix);\n        }\n        let s = &s[prefix_plus.len()..];\n\n        // Parse the `repo` URL.","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/source/git/mod.rs#L255-L291","documentation":"Git URLs in Forc.toml dependencies are parsed with gix_url::Url::from_bytes. Malformed URLs - missing scheme, invalid characters, unsupported syntax - fail parsing, and the underlying gix error string is rethrown from the FromStr implementation.","triggerScenarios":"Writing git = \"github.com/FuelLabs/sway\" (no scheme), URLs containing spaces or invalid characters, or URL forms gix does not support.","commonSituations":"Copy-pasting repo paths from a browser address bar minus the https:// prefix; typos; assuming scp-style shorthand like git@github.com:org/repo parses (it must be a URL form gix understands).","solutions":["Use a fully qualified URL: git = \"https://github.com/FuelLabs/sway\"","For SSH, use the full ssh URL form: ssh://git@github.com/FuelLabs/sway.git","Validate the URL with `git ls-remote <url>` before adding it to Forc.toml"],"exampleFix":"# before\n[dependencies]\nlib = { git = \"github.com/org/lib\" }\n\n# after\n[dependencies]\nlib = { git = \"https://github.com/org/lib\" }","handlingStrategy":"validation","validationCode":"fn validate_git_urls(urls: &[String]) -> anyhow::Result<()> {\n    for url in urls {\n        gix_url::Url::from_bytes(url.as_bytes().into())\n            .with_context(|| format!(\"invalid git url: {url}\"))?;\n    }\n    Ok(())\n}","typeGuard":"fn is_valid_git_url(s: &str) -> bool {\n    gix_url::Url::from_bytes(s.as_bytes().into()).is_ok()\n}","tryCatchPattern":null,"preventionTips":["Use full https:// URLs copied from the browser address bar","For SSH use ssh://git@host/org/repo.git form","Add a CI check that parses every git URL in Forc.toml"],"tags":["git","url","parsing","configuration"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}