{"record":{"id":"dedece5b967fada1","repo":"shadowsocks/shadowsocks-rust","slug":"balancer-check-interval-must-be-0","errorCode":null,"errorMessage":"balancer.check_interval must be > 0","messagePattern":"balancer\\.check_interval must be > 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/shadowsocks-service/src/config.rs","lineNumber":2876,"sourceCode":"                return Err(err);\n            }\n\n            for local_config in &self.local {\n                local_config.config.check_integrity()?;\n            }\n\n            // Balancer related checks\n            if let Some(rtt) = self.balancer.max_server_rtt\n                && rtt.as_secs() == 0\n            {\n                let err = Error::new(ErrorKind::Invalid, \"balancer.max_server_rtt must be > 0\", None);\n                return Err(err);\n            }\n\n            if let Some(intv) = self.balancer.check_interval\n                && intv.as_secs() == 0\n            {\n                let err = Error::new(ErrorKind::Invalid, \"balancer.check_interval must be > 0\", None);\n                return Err(err);\n            }\n        }\n\n        if self.config_type.is_server() && self.server.is_empty() {\n            let err = Error::new(\n                ErrorKind::MissingField,\n                \"missing any valid servers in configuration\",\n                None,\n            );\n            return Err(err);\n        }\n\n        #[cfg(feature = \"local-online-config\")]\n        if self.config_type.is_online_config() && self.server.is_empty() {\n            let err = Error::new(\n                ErrorKind::MissingField,\n                \"missing any valid servers in configuration\",","sourceCodeStart":2858,"sourceCodeEnd":2894,"githubUrl":"https://github.com/shadowsocks/shadowsocks-rust/blob/8eb0f0a65b1d976ab6bed5787327ef86529b0435/crates/shadowsocks-service/src/config.rs#L2858-L2894","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (config.toml)\n[balancer]\ncheck_interval = 0\n\n// after\n[balancer]\ncheck_interval = \"10s\"","handlingStrategy":"validation","validationCode":"// Rust: before loading config\nif let Some(intv) = balancer_check_interval {\n    assert!(intv.as_secs() > 0 || intv.subsec_nanos() > 0, \"check_interval must be > 0\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["config","validation","balancer","duration"],"backgroundTag":"invalid-config-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"}