shadowsocks/shadowsocks-rust · error

missing manager config

Error message

missing manager config

What it means

This panic occurs in the shadowsocks service launcher when config.manager is None but the 'manager' mode was requested. The code unconditionally unwraps config.manager with expect(), so a configuration that lacks the [manager] section cannot start the manager service. It is a fail-fast assertion that the manager config section is mandatory for manager-mode runs.

Source

Thrown at crates/shadowsocks-service/src/manager/mod.rs:34

pub use self::server::{Manager, ManagerBuilder};

pub mod server;

/// Starts a manager server
pub async fn run(config: Config) -> io::Result<()> {
    assert_eq!(config.config_type, ConfigType::Manager);

    trace!("{:?}", config);

    #[cfg(all(unix, not(target_os = "android")))]
    if let Some(nofile) = config.nofile {
        use crate::sys::set_nofile;
        if let Err(err) = set_nofile(nofile) {
            log::warn!("set_nofile {} failed, error: {}", nofile, err);
        }
    }

    let mut manager_builder = ManagerBuilder::new(config.manager.expect("missing manager config"));

    let mut connect_opts = ConnectOpts {
        #[cfg(any(target_os = "linux", target_os = "android"))]
        fwmark: config.outbound_fwmark,
        #[cfg(target_os = "freebsd")]
        user_cookie: config.outbound_user_cookie,

        #[cfg(target_os = "android")]
        vpn_protect_path: config.outbound_vpn_protect_path,

        bind_local_addr: config.outbound_bind_addr.map(|ip| SocketAddr::new(ip, 0)),
        bind_interface: config.outbound_bind_interface,

        ..Default::default()
    };

    connect_opts.tcp.send_buffer_size = config.outbound_send_buffer_size;
    connect_opts.tcp.recv_buffer_size = config.outbound_recv_buffer_size;

View on GitHub (pinned to 8eb0f0a65b)

Solutions

  1. Add the required `manager` section to the config file, e.g. {"manager": {"address": "127.0.0.1:5300"}}
  2. If using CLI flags, ensure --manager-address is passed together with a config that contains manager settings
  3. Validate the config before starting (serde should have a required field or a custom validator) so the process fails with a clear message instead of a panic
  4. If manager mode was not intended, remove the manager flags/mode and run in normal server mode

Example fix

// before (config.json without manager)
{ "server": "127.0.0.1:8388", "password": "pw", "method": "aes-256-gcm" }
// after
{ "server": "127.0.0.1:8388", "password": "pw", "method": "aes-256-gcm", "manager": { "address": "127.0.0.1:5300" } }
Defensive patterns

Strategy: validation

Validate before calling

if config.manager.is_none() {
    return Err(anyhow!("missing manager config: add a \"manager\": {\"address\": ...} section"));
}

Type guard

fn has_manager_config(config: &Config) -> bool { config.manager.is_some() }

Prevention

When it happens

Trigger: Running the shadowsocks manager service (e.g. `sslocal`/`ssserver` with --manager-address or manager mode) with a config file that has no `manager` object, or launching manager mode programmatically via ServerConfig/Config built without setting the manager field.

Common situations: Users copy a plain server config and add only the manager CLI flag; config migration dropping the manager section; hand-written JSON/TOML missing `manager.address`; running the binary with manager flags pointing at a config generated for client mode.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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