tinyhumansai/openhuman · error

URL must include a host

Error message

URL must include a host

What it means

extract_host fails when the authority portion of the https URL (text before the first '/', '?', or '#') is empty, e.g. "https://" or "https:///path". Without a host there is nothing to check against the allowlist or private-host rules.

Source

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

    if d.is_empty() || d.chars().any(char::is_whitespace) {
        return None;
    }

    Some(d)
}

fn extract_host(url: &str) -> anyhow::Result<String> {
    let rest = url
        .strip_prefix("https://")
        .ok_or_else(|| anyhow::anyhow!("Only https:// URLs are allowed"))?;

    let authority = rest
        .split(['/', '?', '#'])
        .next()
        .ok_or_else(|| anyhow::anyhow!("Invalid URL"))?;

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

    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();

View on GitHub (pinned to 7491200858)

Solutions

  1. Include a hostname in the URL (https://example.com/...).
  2. Fix the URL construction that dropped the authority.
Defensive patterns

Strategy: validation

When it happens

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