nautechsystems/nautilus_trader · error

Binance Spot user data stream is not active

Error message

Binance Spot user data stream is not active

What it means

Precondition failure in the Binance Spot execution client: order submission requires the private user-data WebSocket stream plus a running dispatch; submitting before connect() established the listen-key stream bails.

Solutions

  1. Ensure connect() has completed and the user-data stream is active before submitting
  2. Check network connectivity and API key permissions for the user data stream
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/adapters/binance/src/spot/execution.rs:325 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/89d43be0f726976a. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/binance/src/spot/execution.rs:325

                .as_ref()
                .is_some_and(TaskRef::is_active)
        };
        let user_data_active = if self.config.us {
            self.ws_user_data_client
                .lock()
                .as_ref()
                .is_some_and(BinanceSpotWsTradingClient::is_user_data_active)
        } else {
            self.ws_trading_client
                .as_ref()
                .is_some_and(BinanceSpotWsTradingClient::is_user_data_active)
        };

        user_data_active && dispatch_running
    }

    fn ensure_ws_user_data_active(&self) -> anyhow::Result<()> {
        anyhow::ensure!(
            self.ws_user_data_active(),
            "Binance Spot user data stream is not active",
        );
        Ok(())
    }

    fn ws_order_transport_active(&self) -> bool {
        self.config.use_ws_trading && self.ws_trading_client.is_some() && self.ws_user_data_active()
    }

    fn submit_order_internal(&self, cmd: &SubmitOrder) -> anyhow::Result<()> {
        let order = self.core.cache().try_order_owned(&cmd.client_order_id)?;

        let event_emitter = self.emitter.clone();
        let trader_id = self.core.trader_id;
        let account_id = self.core.account_id;
        let client_order_id = order.client_order_id();
        let strategy_id = order.strategy_id();

View on GitHub (pinned to 18893faf8b)