{"record":{"id":"b80b3ab1b6f64762","repo":"GitoxideLabs/gitoxide","slug":"host-is-present-in-url-b80b3a","errorCode":null,"errorMessage":"host is present in url","messagePattern":"host is present in url","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-transport/src/client/blocking_io/connect.rs","lineNumber":55,"sourceCode":"                    crate::client::blocking_io::file::connect(url.path, options.version, options.trace)\n                        .map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)?,\n                )\n            }\n            gix_url::Scheme::Ssh => Box::new({\n                crate::client::blocking_io::ssh::connect(url, options.version, options.ssh, options.trace)\n                    .map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)?\n            }),\n            gix_url::Scheme::Git => {\n                if url.user().is_some() {\n                    return Err(Error::UnsupportedUrlTokens {\n                        url: url.to_bstring(),\n                        scheme: url.scheme,\n                    });\n                }\n                Box::new({\n                    let path = std::mem::take(&mut url.path);\n                    crate::client::git::blocking_io::connect(\n                        url.host().expect(\"host is present in url\"),\n                        path,\n                        options.version,\n                        url.port,\n                        options.trace,\n                    )\n                    .map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)?\n                })\n            }\n            #[cfg(not(any(feature = \"http-client-curl\", feature = \"http-client-reqwest\")))]\n            gix_url::Scheme::Https | gix_url::Scheme::Http => return Err(Error::CompiledWithoutHttp(url.scheme)),\n            #[cfg(feature = \"http-client-curl\")]\n            gix_url::Scheme::Https | gix_url::Scheme::Http => Box::new(\n                crate::client::blocking_io::http::connect::<Curl>(url, options.version, options.trace),\n            ),\n            #[cfg(all(feature = \"http-client-reqwest\", not(feature = \"http-client-curl\")))]\n            gix_url::Scheme::Https | gix_url::Scheme::Http => Box::new(crate::client::blocking_io::http::connect::<\n                Reqwest,\n            >(","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-transport/src/client/blocking_io/connect.rs#L37-L73","documentation":"The blocking (sync) counterpart of the async git-protocol connect: `url.host().expect(\"host is present in url\")` panics when a `git://` URL without a host reaches the file-transport connect path. gix-transport assumes URL parsing guarantees a host for these schemes; violating that assumption aborts the process instead of returning an error.","triggerScenarios":"Calling the blocking connect API with a `git://` URL lacking a host component (e.g. `git://` with empty host).","commonSituations":"Malformed `remote.origin.url` entries in `.git/config`, copy-paste truncation of URLs, or programmatic URL assembly that dropped the host.","solutions":["Fix the URL to include the host: `git://host.tld/path.git`.","Validate with a URL parse (check `host` is present) before invoking connect.","If the URL should be local, use a `file://` or plain path instead of `git://`.","Update gix-transport if a regression allowed host-less git URLs to parse."],"exampleFix":"// before\nurl = \"git:///repo.git\"; // missing host\n// after\nurl = \"git://github.com/user/repo.git\";","handlingStrategy":"validation","validationCode":"let parsed = gix_url::parse(url.as_bytes())?;\nif parsed.scheme == gix_url::Scheme::Git && parsed.host.is_none() {\n    anyhow::bail!(\"git URL missing host\");\n}","typeGuard":"fn connectable(u: &gix_url::Url) -> bool {\n    !matches!(u.scheme, gix_url::Scheme::Git) || u.host.is_some()\n}","tryCatchPattern":"let r = std::panic::catch_unwind(AssertUnwindSafe(|| blocking_connect(url)));\nif r.is_err() { anyhow::bail!(\"connection aborted: URL lacked host\"); }","preventionTips":["Check .git/config remote URLs for truncation before connect","Use file paths for local repos instead of git:// with empty host","Run URL validation in config-loading code"],"tags":["rust","panic","url","network","blocking-io"],"backgroundTag":"invalid-url","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}