tinyhumansai/openhuman · error

URL cannot contain whitespace

Error message

URL cannot contain whitespace

What it means

validate_url rejects URLs containing any whitespace character. Whitespace in a URL passed to the OS opener can split arguments or enable scheme confusion at the shell/browser boundary, so such URLs are refused outright.

Source

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

}

impl BrowserOpenTool {
    pub fn new(security: Arc<SecurityPolicy>, allowed_domains: Vec<String>) -> Self {
        Self {
            security,
            allowed_domains: normalize_allowed_domains(allowed_domains),
        }
    }

    fn validate_url(&self, raw_url: &str) -> anyhow::Result<String> {
        let url = raw_url.trim();

        if url.is_empty() {
            anyhow::bail!("URL cannot be empty");
        }

        if url.chars().any(char::is_whitespace) {
            anyhow::bail!("URL cannot contain whitespace");
        }

        if !url.starts_with("https://") {
            anyhow::bail!("Only https:// URLs are allowed");
        }

        if self.allowed_domains.is_empty() {
            anyhow::bail!(
                "Browser tool is enabled but no allowed_domains are configured. Add [browser].allowed_domains in config.toml"
            );
        }

        let host = extract_host(url)?;

        if is_private_or_local_host(&host) {
            anyhow::bail!("Blocked local/private host: {host}");
        }

View on GitHub (pinned to 7491200858)

Solutions

  1. Percent-encode spaces (%20) instead of embedding raw whitespace.
  2. Trim or clean the URL at the source.
Defensive patterns

Strategy: validation

When it happens

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