shadowsocks/shadowsocks-rust · error

unsupported method

Error message

unsupported method

What it means

This is a sentinel validation error from config parsing: the cipher method string supplied for a server entry is not one of the shadowsocks encryption algorithms the crate recognizes. It fires in the standard-config match arm where server address, port, password, and method are all present but the method value fails to map to a known cipher, so no SupportedCipher can be constructed. The input at fault is the `method` field of the server configuration (e.g. a typo or an unsupported/renamed cipher name like 'aes-256-cfb' or 'rc4-md5').

Source

Thrown at crates/shadowsocks-service/src/config.rs:2152

            ConfigType::OnlineConfig => ServerSource::OnlineConfig,
        };

        // Standard config
        // Server
        match (config.server, config.server_port, config.password, &config.method) {
            (Some(address), Some(port), pwd_opt, Some(m)) => {
                let addr = match address.parse::<Ipv4Addr>() {
                    Ok(v4) => ServerAddr::SocketAddr(SocketAddr::V4(SocketAddrV4::new(v4, port))),
                    Err(..) => match address.parse::<Ipv6Addr>() {
                        Ok(v6) => ServerAddr::SocketAddr(SocketAddr::V6(SocketAddrV6::new(v6, port, 0, 0))),
                        Err(..) => ServerAddr::DomainName(address, port),
                    },
                };

                let method = match m.parse::<CipherKind>() {
                    Ok(m) => m,
                    Err(..) => {
                        let err = Error::new(
                            ErrorKind::Invalid,
                            "unsupported method",
                            Some(format!("`{m}` is not a supported method")),
                        );
                        return Err(err);
                    }
                };

                // Only "password" support getting from environment variable.
                let password = match pwd_opt {
                    Some(ref pwd) => read_variable_field_value(pwd),
                    None => {
                        if method.is_none() {
                            String::new().into()
                        } else {
                            let err = Error::new(
                                ErrorKind::MissingField,
                                "`password` is required",

View on GitHub (pinned to 8eb0f0a65b)

Solutions

  1. Use a supported method such as `aes-256-gcm`, `chacha20-ietf-poly1305`, or `2022-blake3-aes-256-gcm`
  2. Check the exact spelling of the method string
  3. Upgrade/rebuild the crate with the cipher feature flags you need (e.g. `aes-crypto`, or accept `plain` explicitly)
  4. Ask the provider to migrate away from removed legacy ciphers

Example fix

// before
{"method": "aes-256-cfb"}
// after
{"method": "aes-256-gcm"}
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[&str] = &["aes-256-gcm", "aes-128-gcm", "chacha20-ietf-poly1305", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"];
// before load: assert SUPPORTED.contains(&method_str), or parse::<shadowsocks::crypto::CipherKind>() in a pre-check

Try / catch

match method_str.parse::<shadowsocks::crypto::CipherKind>() {
    Ok(k) => k,
    Err(_) => { eprintln!("unsupported method {method_str}"); return; }
}

Prevention

When it happens

Trigger: Config parsing where a server object's `method` string is not a supported cipher: misspelled names, legacy ciphers removed in newer versions (e.g. `rc4-md5`, `aes-256-cfb`), or empty strings.

Common situations: Migrating from old shadowsocks clients using legacy stream ciphers no longer compiled in; typos like `aes-256-gmc`; provider lists a cipher built without the corresponding feature flag; case/format mismatches.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of shadowsocks/shadowsocks-rust@8eb0f0a65b (2026-09-09). Data as JSON: /api/errors/d0e3b77d9506e311. Report an issue: GitHub.