tinyhumansai/openhuman · error

Invalid {field} URL: host is required

Error message

Invalid {field} URL: host is required

What it means

After a proxy URL parses successfully, validate_proxy_url requires a non-empty host (parsed.host_str() must be Some). A value like "http://" or "socks5://" has a scheme but no authority, so there is no server to dial and validation bails.

Source

Thrown at src/openhuman/config/schema/proxy.rs:335

    false
}

fn validate_proxy_url(field: &str, url: &str) -> Result<()> {
    let parsed = reqwest::Url::parse(url)
        .with_context(|| format!("Invalid {field} URL: '{url}' is not a valid URL"))?;

    match parsed.scheme() {
        "http" | "https" | "socks5" | "socks5h" => {}
        scheme => {
            anyhow::bail!(
                "Invalid {field} URL scheme '{scheme}'. Allowed: http, https, socks5, socks5h"
            );
        }
    }

    if parsed.host_str().is_none() {
        anyhow::bail!("Invalid {field} URL: host is required");
    }

    Ok(())
}

fn set_proxy_env_pair(key: &str, value: Option<&str>) {
    let lowercase_key = key.to_ascii_lowercase();
    if let Some(value) = value.and_then(|candidate| normalize_proxy_url_option(Some(candidate))) {
        std::env::set_var(key, &value);
        std::env::set_var(lowercase_key, value);
    } else {
        std::env::remove_var(key);
        std::env::remove_var(lowercase_key);
    }
}

fn clear_proxy_env_pair(key: &str) {
    std::env::remove_var(key);

View on GitHub (pinned to 7491200858)

Solutions

  1. Set a real host/IP with optional port: http://proxy.corp:3128 or socks5://127.0.0.1:1080
  2. If a placeholder was left in the config, replace it with the actual proxy address
  3. Remove proxy URL keys you do not use — absent keys are fine, present keys must be valid

Example fix

# before
https_proxy = "http://"

# after
https_proxy = "http://proxy.corp.example:3128"
Defensive patterns

Strategy: validation

Validate before calling

let parsed: reqwest::Url = value.parse()?;
if parsed.host_str().map(str::is_empty).unwrap_or(true) {
    return Err(format!("{field}: host is required, got '{value}'"));
}

Try / catch

On config-load failure, match messages containing 'host is required' and print the [proxy] block with the offending key highlighted so the user fixes the right line.

Prevention

When it happens

Trigger: [proxy] entries such as http_proxy="http://", all_proxy="socks5h:///path", or values whose host ended up in the path because the '//' after the scheme was omitted (e.g. "http:8080").

Common situations: Template placeholders collapsed to empty (http_proxy = "http://{{host}}" with the variable unset); truncation by env tooling; a typo deleting the host while editing; copy-pasting 'http://' from docs as a prefix example.

Related errors


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