{"record":{"id":"46510ad98455f290","repo":"nautechsystems/nautilus_trader","slug":"recv-window-ms-must-be-in-the-inclusive-range-1","errorCode":null,"errorMessage":"recv_window_ms must be in the inclusive range 1..=60000, was {recv_window_ms}","messagePattern":"recv_window_ms must be in the inclusive range 1\\.\\.=60000, was (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/config.rs","lineNumber":453,"sourceCode":"        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(())\n    }\n}\n\nfn validate_recv_window(recv_window_ms: u64) -> anyhow::Result<()> {\n    anyhow::ensure!(\n        (1..=60_000).contains(&recv_window_ms),\n        \"recv_window_ms must be in the inclusive range 1..=60000, was {recv_window_ms}\"\n    );\n    Ok(())\n}\n\nimpl ClientConfig for BinanceExecClientConfig {\n    fn as_any(&self) -> &dyn Any {\n        self\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use rstest::rstest;\n\n    use super::*;\n","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/config.rs#L435-L471","documentation":"Binance signs every private REST request with a recvWindow timestamp parameter, and the exchange caps it at 60,000 ms. validate_recv_window enforces the inclusive range 1..=60000 on both data and execution client configs so requests are never rejected server-side with a 'Timestamp outside of the recvWindow' error.","triggerScenarios":"Setting recv_window_ms=0 (meaning 'omit'), a negative number, or anything above 60000 (e.g. 120000) in BinanceDataClientConfig or BinanceExecClientConfig; validate() runs in the factory at client creation.","commonSituations":"Trying to work around clock drift between the local machine and Binance servers by inflating recv_window_ms beyond the exchange cap; passing 0 expecting it to disable the parameter; migrating a value from another library that allows larger windows.","solutions":["Choose a value in 1..=60000, e.g. the default or 5000-10000 for typical use.","If you hit recvWindow server errors, fix the host clock (NTP sync) instead of raising the window past 60000.","On high-latency links, use a moderate window (10000-30000) rather than the maximum."],"exampleFix":"# before\nBinanceExecClientConfig(recv_window_ms=120_000)  # above exchange cap\n\n# after\nBinanceExecClientConfig(recv_window_ms=10_000)","handlingStrategy":"validation","validationCode":"assert 1 <= int(config.recv_window_ms) <= 60_000, \\\n    'recv_window_ms must be in 1..=60000'\nconfig.validate()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep recv_window_ms at the default or in 5000-30000 range.","Sync host clocks with NTP instead of widening the window past 60000.","Reject configs loaded from files whose recv_window_ms is absent or zero."],"tags":["binance","config","recv-window","clock-skew","validation"],"backgroundTag":"config-validation-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}