{"record":{"id":"66492cb07901bd81","repo":"nautechsystems/nautilus_trader","slug":"ws-trading-setup-timeout-ms-must-be-greater-than-0","errorCode":null,"errorMessage":"ws_trading_setup_timeout_ms must be greater than 0, was {}","messagePattern":"ws_trading_setup_timeout_ms must be greater than 0, was (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":429,"sourceCode":"    transport_backend: TransportBackend,\n});\n\nimpl Default for BinanceExecutionClientConfig {\n    fn default() -> Self {\n        Self::builder().build()\n    }\n}\n\nimpl BinanceExecutionClientConfig {\n    /// Validates Binance execution client configuration.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error for invalid receive-window, WS trading setup timeout, provider, or\n    /// Binance US settings.\n    pub fn validate(&self) -> anyhow::Result<()> {\n        validate_recv_window(self.recv_window_ms)?;\n        anyhow::ensure!(\n            self.ws_trading_setup_timeout_ms > 0,\n            \"ws_trading_setup_timeout_ms must be greater than 0, was {}\",\n            self.ws_trading_setup_timeout_ms\n        );\n        self.instrument_provider.validate(self.product_type)?;\n\n        if self.us {\n            anyhow::ensure!(\n                self.product_type == BinanceProductType::Spot,\n                \"Binance US supports Spot clients only\"\n            );\n            anyhow::ensure!(\n                self.environment == BinanceEnvironment::Live,\n                \"Binance US supports the Live environment only\"\n            );\n        }\n\n        Ok(())","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/config.rs#L411-L447","documentation":"ws_trading_setup_timeout_ms bounds the time allowed for the WebSocket trading connection to become ready. validate() requires a strictly positive value because a zero timeout would make the setup phase fail immediately/non-deterministically.","triggerScenarios":"Constructing the Binance client config with ws_trading_setup_timeout_ms set to 0 (e.g. from an env var defaulting to 0 or a typo) and calling validate().","commonSituations":"Environment variable parsed as milliseconds defaulting to 0 when unset; misreading the field as a boolean flag or seconds; copy-paste leaving the field at its zero-valued default.","solutions":["Set ws_trading_setup_timeout_ms to a positive value, e.g. 10_000 (10 seconds).","Check where the value is loaded from (env/config file) and provide a sensible default instead of 0.","Confirm the unit is milliseconds, not seconds."],"exampleFix":"// before\nlet config = BinanceDataClientConfig { ws_trading_setup_timeout_ms: 0, .. };\n// after\nlet config = BinanceDataClientConfig { ws_trading_setup_timeout_ms: 10_000, .. };","handlingStrategy":"validation","validationCode":"fn setup_timeout_ok(ms: u64) -> bool { ms > 0 }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a nonzero default (e.g. 10_000 ms) when loading from env vars with Option::unwrap_or.","Remember the unit is milliseconds; configure accordingly.","Validate config early in startup."],"tags":["config","timeout","validation","binance"],"backgroundTag":"invalid-config-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}