tonhowtf/omniget · error

Proxy must include host and port, e.g. http://127.0.0.1:7897

Error message

Proxy must include host and port, e.g. http://127.0.0.1:7897

What it means

After stripping the scheme and any credentials, parse_proxy splits the remaining authority on the last ':' to extract host and port. If there is no colon, the proxy string has no port, which the runtime requires, so this error is raised.

Solutions

  1. Append the explicit port to the proxy URL, e.g. http://127.0.0.1:7897.
  2. If the proxy truly runs on a default port, still write it out: http://proxy:8080 or socks5://proxy:1080.
  3. Verify the full proxy string matches scheme://[user:pass@]host:port.

Example fix

// before
--proxy http://127.0.0.1
// after
--proxy http://127.0.0.1:7897
Defensive patterns

Strategy: validation

Validate before calling

const m = proxyUrl.match(/^[a-z0-9]+:\/\/([^@]+@)?[^:]+:(\d+)$/);
if (!m) throw new Error('Proxy needs explicit host and port, e.g. http://127.0.0.1:7897');

Prevention

When it happens

Trigger: Passing a proxy like 'http://127.0.0.1' or 'http://myproxy' to init_cli_runtime — a host without an explicit ':port' suffix.

Common situations: Users assume the default port (8080/1080) is implied; IPv6 addresses or copy-pasted configs that omit the port.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/1302b6ff43f1cd2b. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-cli/src/commands/common.rs:56

fn parse_proxy(raw: &str) -> Result<ProxySettings> {
    let (scheme, rest) = raw
        .split_once("://")
        .ok_or_else(|| anyhow!("Proxy must include a scheme, e.g. http://127.0.0.1:7897"))?;

    let proxy_type = match scheme {
        "http" | "https" | "socks5" => scheme.to_string(),
        other => return Err(anyhow!("Unsupported proxy scheme: {}", other)),
    };

    let authority = rest.split('/').next().unwrap_or(rest);
    let (auth, host_port) = match authority.rsplit_once('@') {
        Some((auth, host_port)) => (Some(auth), host_port),
        None => (None, authority),
    };

    let (host, port) = host_port
        .rsplit_once(':')
        .ok_or_else(|| anyhow!("Proxy must include host and port, e.g. http://127.0.0.1:7897"))?;

    if host.is_empty() {
        return Err(anyhow!("Proxy host cannot be empty"));
    }

    let port = port
        .parse::<u16>()
        .with_context(|| format!("Invalid proxy port: {}", port))?;

    let (username, password) = match auth.and_then(|a| a.split_once(':')) {
        Some((u, p)) => (u.to_string(), p.to_string()),
        None => (String::new(), String::new()),
    };

    Ok(ProxySettings {
        enabled: true,
        proxy_type,
        host: host.to_string(),

View on GitHub (pinned to 8600b91f42)