{"record":{"id":"b871bcc7762ec99e","repo":"tonhowtf/omniget","slug":"proxy-must-include-a-scheme-e-g-http-127-0-0-1-7897","errorCode":null,"errorMessage":"Proxy must include a scheme, e.g. http://127.0.0.1:7897","messagePattern":"Proxy must include a scheme, e\\.g\\. http://127\\.0\\.0\\.1:7897","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-cli/src/commands/common.rs","lineNumber":41,"sourceCode":"    if let Some(proxy_url) = proxy {\n        http_client::init_proxy(parse_proxy(proxy_url)?);\n    } else {\n        http_client::init_proxy(ProxySettings::default());\n    }\n\n    Ok(())\n}\n\nfn init_cookie_provider() {\n    ytdlp::set_global_cookie_file_fn(|| {\n        reporter::default_cookie_path().map(|path| path.to_string_lossy().to_string())\n    });\n}\n\nfn parse_proxy(raw: &str) -> Result<ProxySettings> {\n    let (scheme, rest) = raw\n        .split_once(\"://\")\n        .ok_or_else(|| anyhow!(\"Proxy must include a scheme, e.g. http://127.0.0.1:7897\"))?;\n\n    let proxy_type = match scheme {\n        \"http\" | \"https\" | \"socks5\" => scheme.to_string(),\n        other => return Err(anyhow!(\"Unsupported proxy scheme: {}\", other)),\n    };\n\n    let authority = rest.split('/').next().unwrap_or(rest);\n    let (auth, host_port) = match authority.rsplit_once('@') {\n        Some((auth, host_port)) => (Some(auth), host_port),\n        None => (None, authority),\n    };\n\n    let (host, port) = host_port\n        .rsplit_once(':')\n        .ok_or_else(|| anyhow!(\"Proxy must include host and port, e.g. http://127.0.0.1:7897\"))?;\n\n    if host.is_empty() {\n        return Err(anyhow!(\"Proxy host cannot be empty\"));","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-cli/src/commands/common.rs#L23-L59","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n--proxy 127.0.0.1:7897\n// after\n--proxy http://127.0.0.1:7897","handlingStrategy":"validation","validationCode":"fn proxy_has_scheme(raw: &str) -> bool { raw.contains(\"://\") }\nensure!(proxy_has_scheme(proxy), \"proxy must include a scheme, e.g. http://127.0.0.1:7897\");","typeGuard":null,"tryCatchPattern":"let settings = parse_proxy(raw).with_context(|| format!(\"invalid --proxy value {raw:?}\"))?;","preventionTips":["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"],"tags":["rust","anyhow","cli","proxy","config"],"backgroundTag":"invalid-url-format","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}