{"record":{"id":"0bfc333b4f3879e8","repo":"tonhowtf/omniget","slug":"proxy-host-cannot-be-empty","errorCode":null,"errorMessage":"Proxy host cannot be empty","messagePattern":"Proxy host cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-cli/src/commands/common.rs","lineNumber":59,"sourceCode":"        .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\"));\n    }\n\n    let port = port\n        .parse::<u16>()\n        .with_context(|| format!(\"Invalid proxy port: {}\", port))?;\n\n    let (username, password) = match auth.and_then(|a| a.split_once(':')) {\n        Some((u, p)) => (u.to_string(), p.to_string()),\n        None => (String::new(), String::new()),\n    };\n\n    Ok(ProxySettings {\n        enabled: true,\n        proxy_type,\n        host: host.to_string(),\n        port,\n        username,\n        password,","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-cli/src/commands/common.rs#L41-L77","documentation":"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.","triggerScenarios":"Passing a proxy like 'http://:7897' or 'socks5://:1080' where the host part before the colon is empty.","commonSituations":"Copy-paste errors where the host got deleted, or template configs where a placeholder host was never filled in.","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."],"exampleFix":"// before\n--proxy http://:7897\n// after\n--proxy http://127.0.0.1:7897","handlingStrategy":"validation","validationCode":"const authority = proxyUrl.split('://')[1] ?? '';\nconst hostPort = authority.split('@').pop() ?? '';\nconst host = hostPort.slice(0, hostPort.lastIndexOf(':'));\nif (!host) throw new Error('Proxy host is empty');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","proxy","validation"],"backgroundTag":"empty-required-field","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"}