tonhowtf/omniget · error

Unsupported proxy scheme

Error message

Unsupported proxy scheme: {}

What it means

parse_proxy validates the scheme portion of a user-supplied proxy URL. Only http, https, and socks5 are supported because those are the proxy types the underlying download runtime can configure. Any other scheme (e.g. socks4, ftp, or a URL with no '://') is rejected with this message.

Solutions

  1. Change the proxy URL scheme to http, https, or socks5 (e.g. socks5://127.0.0.1:7897).
  2. If your proxy is socks5h, use socks5:// instead — hostname resolution happens locally with this tool.
  3. Check the proxy address for typos such as an extra character in the scheme.

Example fix

// before
--proxy socks5h://127.0.0.1:7897
// after
--proxy socks5://127.0.0.1:7897
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['http', 'https', 'socks5']);
const scheme = proxyUrl.split('://')[0];
if (!ALLOWED.has(scheme)) throw new Error(`Use http, https or socks5, got: ${scheme}`);

Prevention

When it happens

Trigger: Calling init_cli_runtime with a --proxy value whose scheme is not exactly http, https, or socks5, e.g. 'socks5h://127.0.0.1:7897', 'ftp://proxy:21', or a scheme written with different casing.

Common situations: Users copy a proxy URL from a VPN/Clash app that uses socks5h, or omit the scheme entirely and get the earlier split error, or mistype 'httpx://'.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

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

    }

    Ok(())
}

fn init_cookie_provider() {
    ytdlp::set_global_cookie_file_fn(|| {
        reporter::default_cookie_path().map(|path| path.to_string_lossy().to_string())
    });
}

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

View on GitHub (pinned to 8600b91f42)