{"record":{"id":"63f4027db149519d","repo":"shadowsocks/shadowsocks-rust","slug":"server-server-port-method-password-must","errorCode":null,"errorMessage":"`server`, `server_port`, `method`, `password` must be provided together","messagePattern":"`server`, `server_port`, `method`, `password` must be provided together","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2230,"sourceCode":"                                },\n                            },\n                        };\n                        nsvr.set_plugin(plugin);\n                    }\n                }\n\n                if let Some(timeout) = config.timeout.map(Duration::from_secs) {\n                    nsvr.set_timeout(timeout);\n                }\n\n                nconfig.server.push(ServerInstanceConfig::with_server_config(nsvr));\n            }\n            (None, None, None, Some(_)) if config_type.is_manager() => {\n                // Set the default method for manager\n            }\n            (None, None, None, None) => (),\n            _ => {\n                let err = Error::new(\n                    ErrorKind::Malformed,\n                    \"`server`, `server_port`, `method`, `password` must be provided together\",\n                    None,\n                );\n                return Err(err);\n            }\n        }\n\n        // Ext servers\n        if let Some(servers) = config.servers {\n            for svr in servers {\n                // Skip if server is disabled\n                if svr.disabled.unwrap_or(false) {\n                    continue;\n                }\n\n                let address = svr.server;\n                let port = svr.server_port;","sourceCodeStart":2212,"sourceCodeEnd":2248,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2212-L2248","documentation":"This error is thrown when parsing a per-server entry in a shadowsocks-service config (the `servers` array, typically from a JSON config or URL) where the `server`, `server_port`, `method`, and `password` fields are only partially specified. The library requires these four fields to be either all present or all absent (with a special allowance for manager configs supplying none, which defaults the method). A partial combination is structurally ambiguous, so the parser rejects it with ErrorKind::Malformed.","triggerScenarios":"Calling Config::load_from_str / load_from_file (or from_url for ss:// URLs) with a server object that has some but not all of `server`, `server_port`, `method`, `password` set — e.g. `server` and `server_port` present but `method` missing, or only `password` present.","commonSituations":"Hand-edited JSON configs where a field was accidentally deleted or commented out; template-generated configs where variable substitution left a field empty; migrating configs between schema versions where field names changed; copy-pasting a partial server block.","solutions":["Add the missing fields so all of `server`, `server_port`, `method`, `password` are present in the server entry","Or remove all four fields if you intended an empty/default server entry (manager configs only)","Validate the JSON against the shadowsocks-service config schema before loading","Use `sslocal`/`ssserver` with a known-good example config as a base"],"exampleFix":"// before\n{\"servers\": [{\"server\": \"1.2.3.4\", \"server_port\": 8388}]}\n// after\n{\"servers\": [{\"server\": \"1.2.3.4\", \"server_port\": 8388, \"method\": \"aes-256-gcm\", \"password\": \"secret\"}]}","handlingStrategy":"validation","validationCode":"let required = [\"server\", \"server_port\", \"method\", \"password\"];\nlet present: Vec<_> = required.iter().filter(|k| svr.get(k).map_or(false, |v| !v.is_null())).collect();\nif !present.is_empty() && present.len() != required.len() {\n    panic!(\"server entry must have all or none of {:?}, missing: {:?}\", required, required.iter().filter(|k| !present.contains(k)).collect::<Vec<_>>());\n}","typeGuard":"fn is_complete_server_entry(svr: &serde_json::Value) -> bool {\n    [\"server\", \"server_port\", \"method\", \"password\"].iter().all(|k| svr.get(k).map_or(false, |v| !v.is_null()))\n}","tryCatchPattern":"match Config::load_from_file(path, ConfigType::Server) {\n    Ok(c) => start(c),\n    Err(e) => eprintln!(\"config rejected: {e}; check server entries have all of server/server_port/method/password\"),\n}","preventionTips":["Never hand-edit server entries piecemeal; edit all four fields together","Lint configs with a JSON schema before loading","Keep password/method in environment-templated variables with non-empty defaults"],"tags":["config","shadowsocks","validation"],"backgroundTag":"conflicting-config-options","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"}