{"record":{"id":"0db090e459b72b6b","repo":"shadowsocks/shadowsocks-rust","slug":"server-shouldn-t-be-an-empty-string-server-por","errorCode":null,"errorMessage":"`server` shouldn't be an empty string, `server_port` shouldn't be 0","messagePattern":"`server` shouldn't be an empty string, `server_port` shouldn't be 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2957,"sourceCode":"                    }\n\n                    #[cfg(feature = \"local-online-config\")]\n                    if self.config_type.is_online_config() {\n                        // Only server could bind to INADDR_ANY\n                        let ip = sa.ip();\n                        if ip.is_unspecified() {\n                            let err = Error::new(\n                                ErrorKind::Malformed,\n                                \"`server` shouldn't be an unspecified address (INADDR_ANY)\",\n                                None,\n                            );\n                            return Err(err);\n                        }\n                    }\n                }\n                ServerAddr::DomainName(dn, port) => {\n                    if dn.is_empty() || *port == 0 {\n                        let err = Error::new(\n                            ErrorKind::Malformed,\n                            \"`server` shouldn't be an empty string, `server_port` shouldn't be 0\",\n                            None,\n                        );\n                        return Err(err);\n                    }\n                }\n            }\n\n            // Users' key must match key length\n            if let Some(user_manager) = server.user_manager() {\n                #[cfg(feature = \"aead-cipher-2022\")]\n                if server.method().is_aead_2022() {\n                    use shadowsocks::config::method_support_eih;\n                    if user_manager.user_count() > 0 && !method_support_eih(server.method()) {\n                        let err = Error::new(\n                            ErrorKind::Invalid,\n                            \"server method doesn't support Extended Identity Header (EIH), remove `users`\",","sourceCodeStart":2939,"sourceCodeEnd":2975,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2939-L2975","documentation":"When a server's address is a domain name (ServerAddr::DomainName), the hostname must be non-empty and the port non-zero. Config::check rejects domain-form entries violating either condition with ErrorKind::Malformed, covering both problems in one message.","triggerScenarios":"A server entry given as hostname:port where the hostname is \"\" or the port is 0 — e.g. server = \"\" with server_port = 8388, an ss:// URL like ss://...@:8388 or ss://...@example.com:0, or a SIP008 entry with an empty server string.","commonSituations":"Template configs where the hostname variable expanded to empty; truncated ss:// links missing the host part; subscription data with blank server names; CLI args where the server host was omitted.","solutions":["Provide a valid hostname (e.g. server = \"example.com\") and a port in 1-65535.","Re-copy the ss:// URL ensuring the host:port section is complete.","If you meant to use an IP, write it explicitly (and note port 0 is still rejected).","Validate the subscription/generator output so server fields are never blank."],"exampleFix":"// before\n{ \"server\": \"\", \"server_port\": 8388, \"password\": \"pw\", \"method\": \"aes-256-gcm\" }\n\n// after\n{ \"server\": \"example.com\", \"server_port\": 8388, \"password\": \"pw\", \"method\": \"aes-256-gcm\" }","handlingStrategy":"validation","validationCode":"// Rust\nassert!(!host.trim().is_empty(), \"server hostname must not be empty\");\nassert!(port != 0, \"server_port must be > 0\");","typeGuard":"fn valid_domain_server(host: &str, port: u16) -> bool {\n    !host.trim().is_empty() && port != 0\n}","tryCatchPattern":null,"preventionTips":["Verify ss:// URLs contain a complete host:port before importing them.","Fail fast in config generators when template variables for host/port are empty.","Validate subscription entries (non-empty server, non-zero port) on ingest."],"tags":["config","domain","validation","port"],"backgroundTag":"empty-required-field","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"}