nautechsystems/nautilus_trader · error

ws_trading_setup_timeout_ms must be greater than 0, was {}

Error message

ws_trading_setup_timeout_ms must be greater than 0, was {}

What it means

BinanceExecClientConfig.validate requires ws_trading_setup_timeout_ms > 0. This timeout bounds the WebSocket trading setup (key-listen / session establishment) and a zero or negative value would mean either an accidental default (u64 wraps) or a request for no timeout at all, which the client does not support.

Source

Thrown at crates/adapters/binance/src/config.rs:430

    transport_backend: TransportBackend,
});

impl Default for BinanceExecClientConfig {
    fn default() -> Self {
        Self::builder().build()
    }
}

impl BinanceExecClientConfig {
    /// Validates Binance execution client configuration.
    ///
    /// # Errors
    ///
    /// Returns an error for invalid receive-window, WS trading setup timeout, provider, or
    /// Binance US settings.
    pub fn validate(&self) -> anyhow::Result<()> {
        validate_recv_window(self.recv_window_ms)?;
        anyhow::ensure!(
            self.ws_trading_setup_timeout_ms > 0,
            "ws_trading_setup_timeout_ms must be greater than 0, was {}",
            self.ws_trading_setup_timeout_ms
        );
        self.instrument_provider.validate(self.product_type)?;

        if self.us {
            anyhow::ensure!(
                self.product_type == BinanceProductType::Spot,
                "Binance US supports Spot clients only"
            );
            anyhow::ensure!(
                self.environment == BinanceEnvironment::Live,
                "Binance US supports the Live environment only"
            );
        }

        Ok(())

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Set a positive millisecond value, e.g. ws_trading_setup_timeout_ms=10_000 (10 seconds).
  2. If you intended 'no timeout', pick a large but finite value (e.g. 120_000) instead of 0.
  3. Check the field default in the current version and only override when you need a different budget.

Example fix

# before
BinanceExecClientConfig(ws_trading_setup_timeout_ms=0)

# after
BinanceExecClientConfig(ws_trading_setup_timeout_ms=10_000)
Defensive patterns

Strategy: validation

Validate before calling

assert isinstance(config.ws_trading_setup_timeout_ms, int)
assert config.ws_trading_setup_timeout_ms > 0
config.validate()

Prevention

When it happens

Trigger: BinanceExecClientConfig(ws_trading_setup_timeout_ms=0) or a negative value (which becomes a huge u64 / is rejected), passed to BinanceExecutionClientFactory. The factory calls validate() before constructing the execution client.

Common situations: Templates that expose the field but leave it unset where the layer below defaults it to 0; attempting to disable the timeout by passing 0; YAML overrides that delete the value.

Understand the failure class

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16). Data as JSON: /api/errors/66492cb07901bd81. Report an issue: GitHub.