{"record":{"id":"a65a51660f4fc8a7","repo":"tinyhumansai/openhuman","slug":"invalid-url-no-host","errorCode":null,"errorMessage":"Invalid URL: no host","messagePattern":"Invalid URL: no host","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/browser/security.rs","lineNumber":57,"sourceCode":"    let without_scheme = url\n        .strip_prefix(\"https://\")\n        .or_else(|| url.strip_prefix(\"http://\"))\n        .or_else(|| url.strip_prefix(\"file://\"))\n        .unwrap_or(url);\n\n    // Extract host — handle bracketed IPv6 addresses like [::1]:8080\n    let authority = without_scheme.split('/').next().unwrap_or(without_scheme);\n\n    let host = if authority.starts_with('[') {\n        // IPv6: take everything up to and including the closing ']'\n        authority.find(']').map_or(authority, |i| &authority[..=i])\n    } else {\n        // IPv4 or hostname: take everything before the port separator\n        authority.split(':').next().unwrap_or(authority)\n    };\n\n    if host.is_empty() {\n        anyhow::bail!(\"Invalid URL: no host\");\n    }\n\n    Ok(host.to_lowercase())\n}\n\npub(crate) fn is_private_host(host: &str) -> bool {\n    // Strip brackets from IPv6 addresses like [::1]\n    let bare = host\n        .strip_prefix('[')\n        .and_then(|h| h.strip_suffix(']'))\n        .unwrap_or(host);\n\n    if bare == \"localhost\" || bare.ends_with(\".localhost\") {\n        return true;\n    }\n\n    // .local TLD (mDNS)\n    if bare","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/browser/security.rs#L39-L75","documentation":"extract_host could not find any host component in the URL: after stripping the scheme and taking the authority segment before the first '/', no usable host remained, so browser security cannot determine which site the navigation targets.","triggerScenarios":"Thrown at src/openhuman/tools/impl/browser/security.rs:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a URL with a non-empty host, e.g. https://example.com/page","Check for a scheme-only URL such as 'https://' or a leading slash where the hostname should be"],"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"}