shadowsocks/shadowsocks-rust · error
balancer.check_interval must be > 0
Error message
balancer.check_interval must be > 0
What it means
During configuration validation, balancer.check_interval (the periodic health-check interval for the server balancer) must be a duration greater than zero. A zero-second interval would cause a busy health-check loop, so Config::check rejects it with ErrorKind::Invalid.
Source
Thrown at crates/shadowsocks-service/src/config.rs:2876
return Err(err);
}
for local_config in &self.local {
local_config.config.check_integrity()?;
}
// Balancer related checks
if let Some(rtt) = self.balancer.max_server_rtt
&& rtt.as_secs() == 0
{
let err = Error::new(ErrorKind::Invalid, "balancer.max_server_rtt must be > 0", None);
return Err(err);
}
if let Some(intv) = self.balancer.check_interval
&& intv.as_secs() == 0
{
let err = Error::new(ErrorKind::Invalid, "balancer.check_interval must be > 0", None);
return Err(err);
}
}
if self.config_type.is_server() && self.server.is_empty() {
let err = Error::new(
ErrorKind::MissingField,
"missing any valid servers in configuration",
None,
);
return Err(err);
}
#[cfg(feature = "local-online-config")]
if self.config_type.is_online_config() && self.server.is_empty() {
let err = Error::new(
ErrorKind::MissingField,
"missing any valid servers in configuration",View on GitHub (pinned to 8eb0f0a65b)
Solutions
- Set check_interval to a positive duration, e.g. check_interval = "10s".
- To disable periodic checking, remove the check_interval key instead of setting it to 0.
- Validate durations before loading by parsing them yourself and asserting as_secs() > 0.
Example fix
// before (config.toml) [balancer] check_interval = 0 // after [balancer] check_interval = "10s"
Defensive patterns
Strategy: validation
Validate before calling
// Rust: before loading config
if let Some(intv) = balancer_check_interval {
assert!(intv.as_secs() > 0 || intv.subsec_nanos() > 0, "check_interval must be > 0");
} Prevention
- Use omission (not 0) to disable health checks.
- Pick sane defaults (e.g. 10s) in config templates instead of 0 placeholders.
- Validate durations with a typed parser (std::time::Duration::from_str) before writing config files.
When it happens
Trigger: Building/loading a local-mode Config where the balancer.check_interval field is Some but its value is 0 seconds (e.g. check_interval = 0 or "0s"), then calling check/validation as part of Config::from_*/load.
Common situations: Hand-written configs where the author set check_interval = 0 to try to disable health checks; templated configs with unfilled 0 placeholders; mistyped duration units so the value collapses to zero seconds.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- balancer.max_server_rtt must be > 0
- `protocol` invalid
- `local_port` cannot be 0
- `local_udp_port` cannot be 0
- invalid `mode`
AI-assisted analysis of shadowsocks/shadowsocks-rust@8eb0f0a65b (2026-09-09).
Data as JSON: /api/errors/dedece5b967fada1.
Report an issue: GitHub.