tonhowtf/omniget · error
Proxy must include a scheme, e.g. http://127.0.0.1:7897
Error message
Proxy must include a scheme, e.g. http://127.0.0.1:7897
What it means
`parse_proxy` in the omniget CLI splits the raw proxy string on "://" and bails if no scheme separator is present, because the proxy type (http/https/socks5) is derived from the scheme. A bare host:port gives no way to pick a protocol.
Solutions
- Prefix the proxy with its scheme: http://127.0.0.1:7897 (or https:// / socks5:// as appropriate)
- If unsure of protocol, try http:// first for local proxies like Clash on 7897
- Fix the exported env var or CLI config to include the scheme
Example fix
// before --proxy 127.0.0.1:7897 // after --proxy http://127.0.0.1:7897
Defensive patterns
Strategy: validation
Validate before calling
fn proxy_has_scheme(raw: &str) -> bool { raw.contains("://") }
ensure!(proxy_has_scheme(proxy), "proxy must include a scheme, e.g. http://127.0.0.1:7897"); Try / catch
let settings = parse_proxy(raw).with_context(|| format!("invalid --proxy value {raw:?}"))?; Prevention
- Always specify scheme in proxy strings (http://, https://, socks5://)
- Check HTTP_PROXY/HTTPS_PROXY env values include schemes
- Document expected proxy format in CLI help
When it happens
Trigger: Passing --proxy 127.0.0.1:7897 (or any scheme-less value) to init_cli_runtime's proxy option instead of http://127.0.0.1:7897.
Common situations: Users copying a proxy address from tooling that omits the scheme (common with Clash/V2Ray local ports); shell config exporting HTTP_PROXY without scheme; docs examples showing bare host:port.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- No downloadable media found for this tweet (it may be…
- Download cancelado
- external_data_cache: plugin_id must not be empty
- external_data_cache: namespace must not be empty
- external_data_cache: plugin_id/namespace must not contain…
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/b871bcc7762ec99e.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-cli/src/commands/common.rs:41
if let Some(proxy_url) = proxy {
http_client::init_proxy(parse_proxy(proxy_url)?);
} else {
http_client::init_proxy(ProxySettings::default());
}
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"));View on GitHub (pinned to 8600b91f42)