tinyhumansai/openhuman · error

URL must include a valid host

Error message

URL must include a valid host

What it means

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.

Source

Thrown at src/openhuman/tools/impl/browser/browser_open.rs:231

    if authority.contains('@') {
        anyhow::bail!("URL userinfo is not allowed");
    }

    if authority.starts_with('[') {
        anyhow::bail!("IPv6 hosts are not supported in browser_open");
    }

    let host = authority
        .split(':')
        .next()
        .unwrap_or_default()
        .trim()
        .trim_end_matches('.')
        .to_lowercase();

    if host.is_empty() {
        anyhow::bail!("URL must include a valid host");
    }

    Ok(host)
}

fn host_matches_allowlist(host: &str, allowed_domains: &[String]) -> bool {
    allowed_domains.iter().any(|domain| {
        host == domain
            || host
                .strip_suffix(domain)
                .is_some_and(|prefix| prefix.ends_with('.'))
    })
}

fn is_private_or_local_host(host: &str) -> bool {
    let has_local_tld = host
        .rsplit('.')
        .next()

View on GitHub (pinned to 7491200858)

Solutions

  1. Provide a URL with a real hostname.
  2. Inspect the URL for malformed authority like 'https://:443/'.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/browser/browser_open.rs:231 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/6e68a0f22c5ed173. Report an issue: GitHub.