tinyhumansai/openhuman · error

Invalid URL: no host

Error message

Invalid URL: no host

What it means

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.

Source

Thrown at src/openhuman/tools/impl/browser/security.rs:57

    let without_scheme = url
        .strip_prefix("https://")
        .or_else(|| url.strip_prefix("http://"))
        .or_else(|| url.strip_prefix("file://"))
        .unwrap_or(url);

    // Extract host — handle bracketed IPv6 addresses like [::1]:8080
    let authority = without_scheme.split('/').next().unwrap_or(without_scheme);

    let host = if authority.starts_with('[') {
        // IPv6: take everything up to and including the closing ']'
        authority.find(']').map_or(authority, |i| &authority[..=i])
    } else {
        // IPv4 or hostname: take everything before the port separator
        authority.split(':').next().unwrap_or(authority)
    };

    if host.is_empty() {
        anyhow::bail!("Invalid URL: no host");
    }

    Ok(host.to_lowercase())
}

pub(crate) fn is_private_host(host: &str) -> bool {
    // Strip brackets from IPv6 addresses like [::1]
    let bare = host
        .strip_prefix('[')
        .and_then(|h| h.strip_suffix(']'))
        .unwrap_or(host);

    if bare == "localhost" || bare.ends_with(".localhost") {
        return true;
    }

    // .local TLD (mDNS)
    if bare

View on GitHub (pinned to 7491200858)

Solutions

  1. Provide a URL with a non-empty host, e.g. https://example.com/page
  2. Check for a scheme-only URL such as 'https://' or a leading slash where the hostname should be
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/browser/security.rs:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/a65a51660f4fc8a7. Report an issue: GitHub.