{"record":{"id":"8985085bbb560f90","repo":"shadowsocks/shadowsocks-rust","slug":"method-898508","errorCode":null,"errorMessage":"method","messagePattern":"method","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/service/manager.rs","lineNumber":367,"sourceCode":"                _ => {\n                    config.manager = Some(ManagerConfig::new(addr));\n                }\n            }\n        }\n\n        #[cfg(all(unix, not(target_os = \"android\")))]\n        match matches.get_one::<u64>(\"NOFILE\") {\n            Some(nofile) => config.nofile = Some(*nofile),\n            None => {\n                if config.nofile.is_none() {\n                    crate::sys::adjust_nofile();\n                }\n            }\n        }\n\n        if let Some(ref mut manager_config) = config.manager {\n            if let Some(m) = matches.get_one::<String>(\"ENCRYPT_METHOD\").cloned() {\n                manager_config.method = Some(m.parse::<CipherKind>().expect(\"method\"));\n            }\n\n            if let Some(t) = matches.get_one::<u64>(\"TIMEOUT\") {\n                manager_config.timeout = Some(Duration::from_secs(*t));\n            }\n\n            if let Some(sh) = matches.get_one::<ManagerServerHost>(\"SERVER_HOST\").cloned() {\n                manager_config.server_host = sh;\n            }\n\n            if let Some(p) = matches.get_one::<String>(\"PLUGIN\").cloned() {\n                manager_config.plugin = Some(PluginConfig {\n                    plugin: p,\n                    plugin_opts: matches.get_one::<String>(\"PLUGIN_OPT\").cloned(),\n                    plugin_args: Vec::new(),\n                    plugin_mode: matches\n                        .get_one::<String>(\"PLUGIN_MODE\")\n                        .map(|x| {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/src/service/manager.rs#L349-L385","documentation":"In the manager service `create`, a user-supplied `ENCRYPT_METHOD` CLI value is parsed with `m.parse::<CipherKind>().expect(\"method\")`. The panic means the string is not a recognized shadowsocks cipher name (e.g. typo or an unsupported algorithm). Parsing happens only when `--encrypt-method` is provided on the command line.","triggerScenarios":"Passing `--encrypt-method` with a value that fails `CipherKind::from_str`, such as \"aes-256-cfb\", \"rc4\", \"AES-256-GCM\" (uppercase not matching), or any cipher not compiled in.","commonSituations":"Copy-pasting cipher names from older shadowsocks docs (legacy stream ciphers removed), wrong casing, using cipher names from other tools (e.g. wireguard or openvpn ciphers).","solutions":["Use a supported AEAD cipher name exactly, e.g. `aes-256-gcm`, `chacha20-ietf-poly1305`, `2022-blake3-aes-256-gcm`","Match casing/spacing exactly as listed in shadowsocks-rust's CipherKind docs (lowercase, hyphenated)","Remove `--encrypt-method` to fall back to the config-file value","Check feature flags — some ciphers require enabling cargo features"],"exampleFix":"// before\n--encrypt-method \"AES-256-GCM\"\n// after\n--encrypt-method \"aes-256-gcm\"","handlingStrategy":"validation","validationCode":"const VALID: &[&str] = &[\"aes-128-gcm\",\"aes-256-gcm\",\"chacha20-ietf-poly1305\",\"2022-blake3-aes-128-gcm\",\"2022-blake3-aes-256-gcm\",\"2022-blake3-chacha8-poly1305\",\"2022-blake3-chacha20-poly1305\"];\nassert!(VALID.contains(&method_str), \"unsupported cipher: {method_str}\");","typeGuard":"fn is_supported_cipher(s: &str) -> bool {\n    matches!(s, \"aes-128-gcm\" | \"aes-256-gcm\" | \"chacha20-ietf-poly1305\")\n}","tryCatchPattern":"// parse instead of expect when embedding the logic\nlet kind: CipherKind = m.parse().map_err(|e| format!(\"invalid --encrypt-method: {e}\"))?;","preventionTips":["Copy cipher names exactly from shadowsocks-rust docs (lowercase, hyphenated)","Use AEAD ciphers only; legacy stream ciphers are removed","Keep client and server method strings identical"],"tags":["cli","encryption","parsing","shadowsocks"],"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-14T11:17:12.474Z"}