tonhowtf/omniget · error
Proxy host cannot be empty
Error message
Proxy host cannot be empty
What it means
Proxy URL parsing guard in parse_proxy: after splitting scheme and userinfo the host:port section has no ':' separator, so the authority lacks a port and the proxy cannot be turned into a valid client config.
Solutions
- Fill in the proxy host before the colon, e.g. http://127.0.0.1:7897.
- If the placeholder was meant for the local proxy, use 127.0.0.1.
- Validate the proxy string with a regex like ^https?|socks5://([^@]+@)?[^:]+:[0-9]+$ before invoking the CLI.
Example fix
// before --proxy http://:7897 // after --proxy http://127.0.0.1:7897
Defensive patterns
Strategy: validation
Validate before calling
const authority = proxyUrl.split('://')[1] ?? '';
const hostPort = authority.split('@').pop() ?? '';
const host = hostPort.slice(0, hostPort.lastIndexOf(':'));
if (!host) throw new Error('Proxy host is empty'); Prevention
- Check proxy strings after copy-paste; placeholders like ':7897' are a common slip
- Fill in template variables before shipping configs
- Lint config files for empty host components
When it happens
Trigger: Passing a proxy like 'http://:7897' or 'socks5://:1080' where the host part before the colon is empty.
Common situations: Copy-paste errors where the host got deleted, or template configs where a placeholder host was never filled in.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Unsupported proxy scheme
- Proxy must include host and port, e.g. http://127.0.0.1:7897
- formato desconhecido
- Proxy must include a scheme, e.g. http://127.0.0.1:7897
- No valid cookies found in file (expected Netscape format)
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/0bfc333b4f3879e8.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-cli/src/commands/common.rs:59
.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(),
port,
username,
password,View on GitHub (pinned to 8600b91f42)