{"record":{"id":"043f1e9e60a8bbe4","repo":"shadowsocks/shadowsocks-rust","slug":"missing-any-valid-servers-in-configuration","errorCode":null,"errorMessage":"missing any valid servers in configuration","messagePattern":"missing any valid servers in configuration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2882,"sourceCode":"\n            // Balancer related checks\n            if let Some(rtt) = self.balancer.max_server_rtt\n                && rtt.as_secs() == 0\n            {\n                let err = Error::new(ErrorKind::Invalid, \"balancer.max_server_rtt must be > 0\", None);\n                return Err(err);\n            }\n\n            if let Some(intv) = self.balancer.check_interval\n                && intv.as_secs() == 0\n            {\n                let err = Error::new(ErrorKind::Invalid, \"balancer.check_interval must be > 0\", None);\n                return Err(err);\n            }\n        }\n\n        if self.config_type.is_server() && self.server.is_empty() {\n            let err = Error::new(\n                ErrorKind::MissingField,\n                \"missing any valid servers in configuration\",\n                None,\n            );\n            return Err(err);\n        }\n\n        #[cfg(feature = \"local-online-config\")]\n        if self.config_type.is_online_config() && self.server.is_empty() {\n            let err = Error::new(\n                ErrorKind::MissingField,\n                \"missing any valid servers in configuration\",\n                None,\n            );\n            return Err(err);\n        }\n\n        if self.config_type.is_manager() && self.manager.is_none() {","sourceCodeStart":2864,"sourceCodeEnd":2900,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2864-L2900","documentation":"When the config's type is a server configuration and the server list is empty, Config::check fails with ErrorKind::MissingField because a shadowsocks server cannot run without at least one server instance (address + password/method).","triggerScenarios":"Calling ssserver (or Config::check) with a config whose config_type is Server and whose server vector is empty — e.g. a server config JSON with no \"server\" entries, or a config built programmatically without pushing any ServerConfig.","commonSituations":"Running ssserver with a config file that only contains global options and no server definitions; a template config where the server array was accidentally deleted; programmatic Config construction that forgot to add servers.","solutions":["Add at least one server entry to the config, e.g. {\"server\":\"0.0.0.0\",\"server_port\":8388,\"password\":\"...\",\"method\":\"aes-256-gcm\"}.","Verify you are using the right binary/config pairing: a local-mode config passed to ssserver will not populate server entries; use sslocal for local configs.","Check that your config loader actually parsed the server key (JSON/TOML key mismatch leaves the list empty)."],"exampleFix":"// before (server.json)\n{ \"server\": [], \"mode\": \"tcp_and_udp\" }\n\n// after\n{ \"server\": [{ \"server\": \"0.0.0.0\", \"server_port\": 8388, \"password\": \"secret\", \"method\": \"aes-256-gcm\" }], \"mode\": \"tcp_and_udp\" }","handlingStrategy":"validation","validationCode":"// Rust\nlet cfg: serde_json::Value = serde_json::from_str(&raw)?;\nassert!(cfg.get(\"server\").and_then(|s| s.as_array()).map_or(false, |a| !a.is_empty()), \"server config needs at least one server entry\");","typeGuard":null,"tryCatchPattern":"// Rust\nmatch Config::load_from_file(&path, ConfigType::Server) {\n    Ok(c) => c,\n    Err(e) if e.to_string().contains(\"missing any valid servers\") => {\n        eprintln!(\"config has no server entries; add one before starting ssserver\");\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Ship example configs with a filled-in server array.","Pair the correct binary (ssserver) with the correct config type (server).","Diff configs against a known-good template after edits."],"tags":["config","validation","server","missing-field"],"backgroundTag":"missing-required-config-field","analyzedSha":"8eb0f0a65b1d976ab6bed5787327ef86529b0435","analyzedAt":"2026-09-09T12:20:43.168Z","contentChangedAt":"2026-09-09T12:20:43.168Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}