{"record":{"id":"f65212bc8c1408d6","repo":"nautechsystems/nautilus_trader","slug":"failed-to-connect-binance-spot-sbe-websocket-e","errorCode":null,"errorMessage":"failed to connect Binance Spot SBE WebSocket: {e}","messagePattern":"failed to connect Binance Spot SBE WebSocket: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/data.rs","lineNumber":1528,"sourceCode":"        Self::refresh_instrument_catalogue(\n            &self.http_client,\n            &self.config.instrument_provider,\n            self.config.us,\n            &self.instruments,\n            &self.status_cache,\n            &self.ws_client,\n            &self.data_sender,\n            self.clock,\n            false,\n        )\n        .await?;\n\n        match &mut self.ws_client {\n            SpotWsClient::Sbe(ws_client) => {\n                log::info!(\"Connecting to Binance Spot SBE WebSocket...\");\n                ws_client.connect().await.map_err(|e| {\n                    log::error!(\"Binance Spot SBE WebSocket connection failed: {e:?}\");\n                    anyhow::anyhow!(\"failed to connect Binance Spot SBE WebSocket: {e}\")\n                })?;\n                log::info!(\"Binance Spot SBE WebSocket connected\");\n\n                let stream = ws_client.stream();\n                let sender = self.data_sender.clone();\n                let insts = self.instruments.clone();\n                let ws_insts = ws_client.instruments_cache();\n                let buffers = self.book_buffers.clone();\n                let book_subs = self.book_subscriptions.clone();\n                let l1_book_subs = self.l1_book_subscriptions.clone();\n                let book_epoch = self.book_epoch.clone();\n                let http = self.http_client.clone();\n                let clock = self.clock;\n                let cancel = self.cancellation_token.clone();\n\n                let handle = get_runtime().spawn(async move {\n                    pin_mut!(stream);\n","sourceCodeStart":1510,"sourceCodeEnd":1546,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/data.rs#L1510-L1546","documentation":"The Binance Spot SBE (Simple Binary Encoding) market data WebSocket failed to connect. Unlike the Futures variant, this error preserves the underlying cause in {e} and also logs it in Debug form, so the message itself tells you whether it is authentication, network, or endpoint related.","triggerScenarios":"connect() on the Spot SBE market data stream errors: invalid or wrong-type API credentials (SBE requires the Ed25519 keypair), rejected authentication, unreachable/blocked SBE WebSocket endpoint, TLS or proxy problems, or a Binance-side outage of the SBE service.","commonSituations":"Using an HMAC key instead of Ed25519 for SBE; expired or deleted API key; egress firewall blocking the SBE endpoint; proxy misconfiguration; SBE access unavailable for the account or region.","solutions":["Read {e} in the message: 401/403-style errors mean credential problems, timeouts mean network reachability","Verify the Ed25519 keypair works by performing a signed REST request with the same key","Check egress and proxy settings toward the Binance Spot SBE WebSocket endpoint","If SBE is unavailable for your account/region, fall back to spot_market_data_mode = Json"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Pre-flight: a signed REST call with the Ed25519 key validates credentials\n# before the SBE WS connect is attempted\nresp = requests.get(\n    \"https://api.binance.com/api/v3/account\",\n    headers={\"X-MBX-APIKEY\": api_key},\n    params=signed_params(ed25519_key),\n    timeout=10,\n)\nresp.raise_for_status()","typeGuard":null,"tryCatchPattern":"On connect failure, inspect {e} from the message: credential errors (401/403) should fail fast with an operator alert; network timeouts can retry with exponential backoff. Persistent SBE unavailability can fall back to spot_market_data_mode = Json.","preventionTips":["Use an Ed25519 keypair (not HMAC) for SBE mode","Pre-flight credentials with a signed REST call","Keep a Json-mode fallback config ready for SBE outages"],"tags":["binance","spot","sbe","websocket","connection","authentication"],"backgroundTag":"websocket-connection-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}