{"record":{"id":"afe68243eb1d789c","repo":"getzola/zola","slug":"could-not-parse-domain-from-link-afe682","errorCode":null,"errorMessage":"could not parse domain `{}` from link: `{}`","messagePattern":"could not parse domain `(.+?)` from link: `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"components/site/src/link_checking.rs","lineNumber":124,"sourceCode":"    }\n    messages\n}\n\nfn should_skip_by_prefix(link: &str, skip_prefixes: &[String]) -> bool {\n    skip_prefixes.iter().any(|prefix| link.starts_with(prefix))\n}\n\nfn should_skip_by_file(file_path: &Path, glob_set: &GlobSet) -> bool {\n    glob_set.is_match(file_path)\n}\n\nfn get_link_domain(link: &str) -> Result<String> {\n    match Url::parse(link) {\n        Ok(url) => match url.host_str().map(String::from) {\n            Some(domain_str) => Ok(domain_str),\n            None => bail!(\"could not parse domain `{}` from link\", link),\n        },\n        Err(err) => bail!(\"could not parse domain `{}` from link: `{}`\", link, err),\n    }\n}\n\n/// Checks all external links and returns all the errors that were encountered.\n/// Empty vec == all good\npub fn check_external_links(site: &Site) -> Vec<String> {\n    struct LinkDef {\n        file_path: PathBuf,\n        external_link: String,\n        domain: String,\n    }\n\n    impl LinkDef {\n        pub fn new(file_path: &Path, external_link: &str, domain: String) -> Self {\n            Self {\n                file_path: file_path.to_path_buf(),\n                external_link: external_link.to_string(),\n                domain,","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/components/site/src/link_checking.rs#L106-L142","documentation":"This is the parse-failure branch of `get_link_domain`: `Url::parse(link)` returned an Err (e.g. relative URL without a base), and the function bails embedding both the link and the underlying url-crate error. Called from `check_external_links` while validating external links.","triggerScenarios":"`get_link_domain` is called with a string that is not an absolute URL — missing scheme (`example.com/page`), malformed characters, or any input the `url` crate's parser rejects.","commonSituations":"Markdown/HTML content with bare domains without `http://`, typos in hrefs, templating that concatenates paths where a full URL was expected.","solutions":["Fix the link in the content so it is a fully-qualified absolute URL including scheme","Pre-validate links with `Url::parse` and skip/flag relative links before calling this function","Inspect the embedded url-crate error (`RelativeUrlWithoutBase` most commonly) to identify the malformation"],"exampleFix":"// before\n[example.com](example.com)\n// after\n[example.com](https://example.com)","handlingStrategy":"validation","validationCode":"fn is_parseable_url(link: &str) -> bool { Url::parse(link).is_ok() }","typeGuard":"fn as_url(link: &str) -> Option<Url> { Url::parse(link).ok() }","tryCatchPattern":"match get_link_domain(link) {\n    Ok(d) => check(d),\n    Err(e) => link_errors.push(format!(\"fix href: {e}\")),\n}","preventionTips":["Always write links with an explicit scheme (https://)","Lint content files for bare-domain hrefs in CI","Keep the url-crate error text in reports to spot RelativeUrlWithoutBase quickly"],"tags":["rust","url-parsing","link-checker"],"backgroundTag":"url-parse-failed","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}