{"record":{"id":"cbf3068f8aeab4cd","repo":"shadowsocks/shadowsocks-rust","slug":"method-cbf306","errorCode":null,"errorMessage":"method","messagePattern":"method","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/service/local.rs","lineNumber":633,"sourceCode":"                logging::init_with_file(path);\n            }\n            None => {\n                logging::init_with_config(\"sslocal\", &service_config.log);\n            }\n        }\n\n        trace!(\"{:?}\", service_config);\n\n        let mut config = match config_path_opt {\n            Some(cpath) => Config::load_from_file(&cpath, ConfigType::Local)\n                .map_err(|err| ShadowsocksError::LoadConfigFailure(format!(\"loading config {cpath:?}, {err}\")))?,\n            None => Config::new(ConfigType::Local),\n        };\n\n        if let Some(svr_addr) = matches.get_one::<String>(\"SERVER_ADDR\") {\n            let method = matches\n                .get_one::<String>(\"ENCRYPT_METHOD\")\n                .map(|x| x.parse::<CipherKind>().expect(\"method\"))\n                .expect(\"`method` is required\");\n\n            let password = match matches.get_one::<String>(\"PASSWORD\") {\n                Some(pwd) => read_variable_field_value(pwd).into(),\n                None => {\n                    // NOTE: svr_addr should have been checked by crate::vparser\n                    if method.is_none() {\n                        // If method doesn't need a key (none, plain), then we can leave it empty\n                        String::new()\n                    } else {\n                        match crate::password::read_server_password(svr_addr) {\n                            Ok(pwd) => pwd,\n                            Err(..) => panic!(\"`password` is required for server {svr_addr}\"),\n                        }\n                    }\n                }\n            };\n","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/src/service/local.rs#L615-L651","documentation":"In local service config creation, when SERVER_ADDR is present the ENCRYPT_METHOD value is parsed into a CipherKind; an unknown method name makes parse fail and .expect(\"method\") panics. It guarantees every server entry has a recognized cipher before building the ServerConfig.","triggerScenarios":"Running sslocal with a server address (-b/-s SERVER_ADDR) plus an --encrypt-method string that is not a valid CipherKind (typo, unsupported algorithm, or crypto feature disabled).","commonSituations":"Config-file/URL server entries carrying legacy cipher names (e.g. rc4-md5, aes-256-cfb) removed in newer versions; typos; SIP002 plugin configs ported from older clients.","solutions":["Use a supported AEAD cipher name: aes-128-gcm, aes-256-gcm, chacha20-ietf-poly1305, or a 2022-blake3 variant.","Replace legacy stream ciphers (aes-*-cfb, rc4-md5) that were dropped from the crypto crate.","Enable the matching shadowsocks-crypto feature or update the binary if the cipher exists upstream."],"exampleFix":"// before\nsslocal -b 127.0.0.1:1080 -s example.com:8388 --encrypt-method aes-256-cfb -k secret\n\n// after\nsslocal -b 127.0.0.1:1080 -s example.com:8388 --encrypt-method aes-256-gcm -k secret","handlingStrategy":"validation","validationCode":"let method = match matches.get_one::<String>(\"ENCRYPT_METHOD\") {\n    Some(s) => s.parse::<CipherKind>().map_err(|_| format!(\"invalid encrypt-method: {}\", s))?,\n    None => return Err(\"`method` is required with SERVER_ADDR\".into()),\n};","typeGuard":null,"tryCatchPattern":"let kind: CipherKind = s.parse().map_err(|e| ShadowsocksError::InvalidConfig(format!(\"bad encrypt-method: {e}\")))?;","preventionTips":["Whenever -s/SERVER_ADDR is set, always pair it with --encrypt-method and --password.","Prefer a config file for server entries to avoid long, error-prone CLI lines.","Test the exact command line once in a shell before putting it in scripts/systemd units."],"tags":["cli","rust","config","cipher","panic"],"backgroundTag":"invalid-enum-value","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"}