{"record":{"id":"6e68a0f22c5ed173","repo":"tinyhumansai/openhuman","slug":"url-must-include-a-valid-host","errorCode":null,"errorMessage":"URL must include a valid host","messagePattern":"URL must include a valid host","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/browser/browser_open.rs","lineNumber":231,"sourceCode":"\n    if authority.contains('@') {\n        anyhow::bail!(\"URL userinfo is not allowed\");\n    }\n\n    if authority.starts_with('[') {\n        anyhow::bail!(\"IPv6 hosts are not supported in browser_open\");\n    }\n\n    let host = authority\n        .split(':')\n        .next()\n        .unwrap_or_default()\n        .trim()\n        .trim_end_matches('.')\n        .to_lowercase();\n\n    if host.is_empty() {\n        anyhow::bail!(\"URL must include a valid host\");\n    }\n\n    Ok(host)\n}\n\nfn host_matches_allowlist(host: &str, allowed_domains: &[String]) -> bool {\n    allowed_domains.iter().any(|domain| {\n        host == domain\n            || host\n                .strip_suffix(domain)\n                .is_some_and(|prefix| prefix.ends_with('.'))\n    })\n}\n\nfn is_private_or_local_host(host: &str) -> bool {\n    let has_local_tld = host\n        .rsplit('.')\n        .next()","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/browser/browser_open.rs#L213-L249","documentation":"extract_host's final check: after stripping the port and trailing dot and lowercasing, the host is empty (e.g. authority was ':' or '.'). A hostless URL cannot be validated against the allowlist, so it fails with a distinct message from the empty-authority case.","triggerScenarios":"Thrown at src/openhuman/tools/impl/browser/browser_open.rs:231 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a URL with a real hostname.","Inspect the URL for malformed authority like 'https://:443/'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}