{"record":{"id":"46d9967323cff438","repo":"shadowsocks/shadowsocks-rust","slug":"invalid-outbound-proxy","errorCode":null,"errorMessage":"invalid outbound_proxy","messagePattern":"invalid outbound_proxy","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2441,"sourceCode":"                    server_instance.outbound_bind_addr = Some(outbound_bind_addr);\n                }\n\n                if let Some(ref outbound_bind_interface) = svr.outbound_bind_interface {\n                    server_instance.outbound_bind_interface = Some(outbound_bind_interface.clone());\n                }\n\n                if let Some(outbound_udp_allow_fragmentation) = svr.outbound_udp_allow_fragmentation {\n                    server_instance.outbound_udp_allow_fragmentation = Some(outbound_udp_allow_fragmentation);\n                }\n\n                if let Some(inbound_udp_allow_fragmentation) = svr.inbound_udp_allow_fragmentation {\n                    server_instance.inbound_udp_allow_fragmentation = Some(inbound_udp_allow_fragmentation);\n                }\n\n                if let Some(proxy_config) = svr.outbound_proxy {\n                    server_instance.outbound_proxy = proxy_config\n                        .into_proxies()\n                        .map_err(|e| Error::new(ErrorKind::Invalid, \"invalid outbound_proxy\", Some(e)))?;\n                }\n\n                nconfig.server.push(server_instance);\n            }\n        }\n\n        // Set timeout globally\n        if let Some(timeout) = config.timeout {\n            let timeout = Duration::from_secs(timeout);\n            // Set as a default timeout\n            for inst in &mut nconfig.server {\n                let svr = &mut inst.config;\n                if svr.timeout().is_none() {\n                    svr.set_timeout(timeout);\n                }\n            }\n        }\n","sourceCodeStart":2423,"sourceCodeEnd":2459,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2423-L2459","documentation":"shadowsocks-service validates each server's optional outbound_proxy when loading a service config. The configured proxy is converted into concrete proxy entries via into_proxies(); if that conversion fails (e.g. an unparsable proxy URL or unsupported scheme), the loader aborts with ErrorKind::Invalid and the message 'invalid outbound_proxy', attaching the underlying cause.","triggerScenarios":"Parsing a server config (JSON or builder) where svr.outbound_proxy is Some, and into_proxies() fails — typically a malformed proxy URL string or a proxy scheme the library does not support.","commonSituations":"Typo in a socks5/http proxy URL in the JSON config; using a scheme like https:// or vmess:// that shadowsocks outbound proxy does not support; leaving an empty or truncated proxy string after editing the config by hand.","solutions":["Check the nested cause (e) in the error for the exact parse failure","Fix the proxy URL syntax in the server's outbound_proxy config field","Use a supported scheme (socks5, http) for outbound_proxy","Remove outbound_proxy from the server config if no outbound proxy is needed"],"exampleFix":"// before\n\"outbound_proxy\": \"socks5//127.0.0.1:1080\"\n// after\n\"outbound_proxy\": \"socks5://127.0.0.1:1080\"","handlingStrategy":"validation","validationCode":"fn validate_outbound_proxy(p: &str) -> Result<(), String> {\n    let (scheme, rest) = p.split_once(\"://\")\n        .ok_or_else(|| \"proxy URL missing '://'\".to_string())?;\n    match scheme {\n        \"socks5\" | \"http\" => (),\n        other => return Err(format!(\"unsupported proxy scheme: {other}\")),\n    }\n    if rest.is_empty() { return Err(\"proxy URL has empty host\".into()); }\n    Ok(())\n}","typeGuard":"fn is_supported_proxy_scheme(p: &str) -> bool {\n    matches!(p.split_once(\"://\"), Some((\"socks5\" | \"http\", _)))\n}","tryCatchPattern":"match server_cfg.outbound_proxy {\n    Some(p) => match p.into_proxies() {\n        Ok(proxies) => instance.outbound_proxy = proxies,\n        Err(e) => eprintln!(\"bad outbound_proxy: {e}\"),\n    },\n    None => {}\n}","preventionTips":["Always use scheme://host:port form for proxy URLs","Stick to socks5 or http schemes supported by shadowsocks","Validate proxy URLs when generating configs programmatically","Read the nested cause error for the precise parse failure"],"tags":["config","proxy","shadowsocks","url-parse"],"backgroundTag":"invalid-config-value","analyzedSha":"8eb0f0a65b1d976ab6bed5787327ef86529b0435","analyzedAt":"2026-09-09T12:20:43.168Z","contentChangedAt":"2026-09-09T12:20:43.168Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}