shadowsocks/shadowsocks-rust · error

`server` shouldn't be an unspecified address (INADDR_ANY)

Error message

`server` shouldn't be an unspecified address (INADDR_ANY)

What it means

For local-mode configurations, the remote server address must be a concrete host — it cannot be an unspecified address (0.0.0.0 or ::). INADDR_ANY is only meaningful for listeners, not for the server a local client connects to, so Config::check rejects it with ErrorKind::Malformed.

Solutions

  1. Replace the unspecified address with the actual server IP or hostname, e.g. server = "1.2.3.4" or "example.com".
  2. Do not use 0.0.0.0 in local configs — that value belongs only in local_address/listen addresses for servers.
  3. Fix the subscription/provider data if it is publishing 0.0.0.0 as the server address.

Example fix

// before (local.json)
{ "server": "0.0.0.0", "server_port": 8388, "password": "pw", "method": "aes-256-gcm" }

// after
{ "server": "203.0.113.7", "server_port": 8388, "password": "pw", "method": "aes-256-gcm" }
Defensive patterns

Strategy: validation

Validate before calling

// Rust
if let Ok(ip) = server.parse::<std::net::IpAddr>() {
    assert!(!ip.is_unspecified(), "local config server must not be 0.0.0.0 or ::");
}

Type guard

fn is_concrete_host(host: &str) -> bool {
    match host.parse::<std::net::IpAddr>() {
        Ok(ip) => !ip.is_unspecified(),
        Err(_) => !host.trim().is_empty(),
    }
}

Prevention

When it happens

Trigger: A local (sslocal) config where a server entry's address is 0.0.0.0 or :: with a non-zero port, e.g. server = "0.0.0.0", or an ss:// URL with host 0.0.0.0.

Common situations: Users copying the bind-address 0.0.0.0 (correct for ssserver listeners) into the server field of an sslocal config; subscription data with an unspecified address; templates that substitute an empty host defaulting to 0.0.0.0.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

                && plugin.plugin.trim().is_empty()
            {
                let err = Error::new(ErrorKind::Malformed, "`plugin` shouldn't be an empty string", None);
                return Err(err);
            }

            // Server's domain name shouldn't be an empty string
            match server.addr() {
                ServerAddr::SocketAddr(sa) => {
                    if sa.port() == 0 {
                        let err = Error::new(ErrorKind::Malformed, "`server_port` shouldn't be 0", None);
                        return Err(err);
                    }

                    if self.config_type.is_local() {
                        // Only server could bind to INADDR_ANY
                        let ip = sa.ip();
                        if ip.is_unspecified() {
                            let err = Error::new(
                                ErrorKind::Malformed,
                                "`server` shouldn't be an unspecified address (INADDR_ANY)",
                                None,
                            );
                            return Err(err);
                        }
                    }

                    #[cfg(feature = "local-online-config")]
                    if self.config_type.is_online_config() {
                        // Only server could bind to INADDR_ANY
                        let ip = sa.ip();
                        if ip.is_unspecified() {
                            let err = Error::new(
                                ErrorKind::Malformed,
                                "`server` shouldn't be an unspecified address (INADDR_ANY)",
                                None,
                            );

View on GitHub (pinned to 8eb0f0a65b)