tinyhumansai/openhuman · error

Invalid URL

Error message

Invalid URL

What it means

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.

Source

Thrown at src/openhuman/tools/impl/network/url_guard.rs:229

    }

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

    Some(d)
}

pub(super) fn extract_host(url: &str) -> anyhow::Result<String> {
    let rest = url
        .strip_prefix("http://")
        .or_else(|| url.strip_prefix("https://"))
        .ok_or_else(|| anyhow::anyhow!("Only http:// and 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 http_request");
    }

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

View on GitHub (pinned to 7491200858)

Solutions

  1. Supply a well-formed absolute http:// or https:// URL with a host component
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/network/url_guard.rs:229 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/214a48f78a548491. Report an issue: GitHub.