{"record":{"id":"d278e4eb1af65eda","repo":"shadowsocks/shadowsocks-rust","slug":"server-config-create-failed","errorCode":null,"errorMessage":"server config create failed","messagePattern":"server config create failed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2181,"sourceCode":"                    Some(ref pwd) => read_variable_field_value(pwd),\n                    None => {\n                        if method.is_none() {\n                            String::new().into()\n                        } else {\n                            let err = Error::new(\n                                ErrorKind::MissingField,\n                                \"`password` is required\",\n                                Some(format!(\"`password` is required for method {method}\")),\n                            );\n                            return Err(err);\n                        }\n                    }\n                };\n\n                let mut nsvr = match ServerConfig::new(addr, password, method) {\n                    Ok(svr) => svr,\n                    Err(serr) => {\n                        let err = Error::new(\n                            ErrorKind::Malformed,\n                            \"server config create failed\",\n                            Some(format!(\"{}\", serr)),\n                        );\n                        return Err(err);\n                    }\n                };\n                nsvr.set_source(server_source);\n                nsvr.set_mode(global_mode);\n\n                if let Some(ref p) = config.plugin {\n                    // SIP008 allows \"plugin\" to be an empty string\n                    // Empty string implies \"no plugin\"\n                    if !p.is_empty() {\n                        let plugin = PluginConfig {\n                            plugin: p.clone(),\n                            plugin_opts: config.plugin_opts.clone(),\n                            plugin_args: config.plugin_args.clone().unwrap_or_default(),","sourceCodeStart":2163,"sourceCodeEnd":2199,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2163-L2199","documentation":"Thrown when ServerConfig::new(addr, password, method) fails while building a server entry from parsed JSON config. The cipher-specific validation error from ServerConfig is wrapped in ErrorKind::Malformed.","triggerScenarios":"Parsing a server entry whose combination of address, password, and method is rejected by ServerConfig::new — most commonly a password that is invalid for the chosen AEAD/2022 method (e.g. `2022-blake3-*` requiring base64 keys of exact length, or too-short passwords for some ciphers).","commonSituations":"Using SIP008/JSON config with `2022-blake3-aes-256-gcm` / `2022-blake3-chacha20-poly1305` and passwords that are not valid base64 32/16-byte keys; reusing plain-text passwords with 2022 ciphers; method/password pairs copied between incompatible servers.","solutions":["For `2022-*` methods, generate a proper base64 key (e.g. `openssl rand -base64 32` for aes-256) and use it as the password","Read the wrapped inner error message (`format!(\"{}\", serr)`) to see the exact cipher-level complaint","Downgrade/choose a method matching your existing password format, or re-key the server and client together","Verify server and client use identical method and key"],"exampleFix":"// before\n{\"method\": \"2022-blake3-aes-256-gcm\", \"password\": \"mypassword\"}\n// after\n{\"method\": \"2022-blake3-aes-256-gcm\", \"password\": \"h3jRkW3...base64 32-byte key...==\"}","handlingStrategy":"validation","validationCode":"// pre-check for 2022 methods:\nif method.starts_with(\"2022-\") {\n    base64::decode(password).map_err(|_| \"password must be valid base64 key\")?;\n    // expected lengths: 16 bytes (aes-128 / chacha20), 32 bytes (aes-256)\n}","typeGuard":null,"tryCatchPattern":"match ServerConfig::new(addr, password.clone(), method) {\n    Ok(svr) => svr,\n    Err(e) => { eprintln!(\"invalid server credentials: {e}\"); return; }\n}","preventionTips":["Generate 2022-cipher passwords with `openssl rand -base64 32`","Keep server and client keys identical and in sync","Read the wrapped inner error; it names the exact validation that failed"],"tags":["config","server","cipher"],"backgroundTag":"invalid-constructor-argument","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"}