{"record":{"id":"214a48f78a548491","repo":"tinyhumansai/openhuman","slug":"invalid-url-214a48","errorCode":null,"errorMessage":"Invalid URL","messagePattern":"Invalid URL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/network/url_guard.rs","lineNumber":229,"sourceCode":"    }\n\n    if d.is_empty() || d.chars().any(char::is_whitespace) {\n        return None;\n    }\n\n    Some(d)\n}\n\npub(super) fn extract_host(url: &str) -> anyhow::Result<String> {\n    let rest = url\n        .strip_prefix(\"http://\")\n        .or_else(|| url.strip_prefix(\"https://\"))\n        .ok_or_else(|| anyhow::anyhow!(\"Only http:// and https:// URLs are allowed\"))?;\n\n    let authority = rest\n        .split(['/', '?', '#'])\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid URL\"))?;\n\n    if authority.is_empty() {\n        anyhow::bail!(\"URL must include a host\");\n    }\n\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 http_request\");\n    }\n\n    let host = authority\n        .split(':')\n        .next()\n        .unwrap_or_default()\n        .trim()","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/network/url_guard.rs#L211-L247","documentation":"extract_host strips the http(s):// prefix and splits the remainder on '/', '?', '#' to isolate the authority; 'Invalid URL' is the degenerate branch where that split yields nothing (effectively unreachable for non-empty input). It signals a malformed authority during SSRF validation, not a network failure.","triggerScenarios":"Thrown at src/openhuman/tools/impl/network/url_guard.rs:229 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply a well-formed absolute http:// or https:// URL with a host component"],"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-14T00:17:10.932Z"}