{"record":{"id":"5d88068ec6508cbc","repo":"nautechsystems/nautilus_trader","slug":"binance-spot-24-hour-ticker-custom-data-requires-j","errorCode":null,"errorMessage":"Binance Spot 24-hour ticker custom data requires JSON market-data mode","messagePattern":"Binance Spot 24-hour ticker custom data requires JSON market-data mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/data.rs","lineNumber":1784,"sourceCode":"    }\n\n    fn is_connected(&self) -> bool {\n        self.is_connected.load(Ordering::Relaxed)\n    }\n\n    fn is_disconnected(&self) -> bool {\n        !self.is_connected()\n    }\n\n    fn subscribe(&mut self, cmd: SubscribeCustomData) -> anyhow::Result<()> {\n        if cmd.data_type.type_name() != \"BinanceSpotTicker\" {\n            log::warn!(\n                \"Unsupported custom data subscription: {}\",\n                cmd.data_type.type_name()\n            );\n            return Ok(());\n        }\n        anyhow::ensure!(\n            self.spot_market_data_mode == BinanceSpotMarketDataMode::Json,\n            \"Binance Spot 24-hour ticker custom data requires JSON market-data mode\"\n        );\n        let instrument_id = Self::required_instrument_id_metadata(&cmd.data_type)?;\n        anyhow::ensure!(\n            instrument_id.venue == self.venue(),\n            \"Spot ticker requires a BINANCE instrument\"\n        );\n        let should_subscribe = {\n            let previous = self\n                .ticker_refs\n                .load()\n                .get(&instrument_id)\n                .copied()\n                .unwrap_or(0);\n            self.ticker_refs\n                .rcu(|refs| *refs.entry(instrument_id).or_insert(0) += 1);\n            previous == 0","sourceCodeStart":1766,"sourceCodeEnd":1802,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/data.rs#L1766-L1802","documentation":"Subscribing to BinanceSpot 24-hour ticker custom data is only supported when the data client runs in JSON market-data mode; the SBE mode does not deliver this custom data type. The client rejects the Subscribe command with anyhow::ensure! before touching the WebSocket.","triggerScenarios":"Calling subscribe with a custom data type of Binance spot 24hr ticker while spot_market_data_mode == Sbe (e.g. client created in SBE mode, or defaulting to SBE).","commonSituations":"User requests ticker subscriptions via a strategy or node config but the adapter was launched with SBE market-data mode; switching adapters without updating data-type config.","solutions":["Configure the Binance Spot data client to use JSON market-data mode (BinanceSpotMarketDataMode::Json) before connecting.","Or remove/replace the 24-hour ticker subscription with a data type supported in SBE mode.","Check the adapter factory/config that selects market-data mode and align it with requested data types."],"exampleFix":"// before\nlet config = BinanceDataClientConfig::builder().spot_market_data_mode(BinanceSpotMarketDataMode::Sbe).build();\n// after\nlet config = BinanceDataClientConfig::builder().spot_market_data_mode(BinanceSpotMarketDataMode::Json).build();","handlingStrategy":"validation","validationCode":"fn ticker_requires_json_mode(mode: BinanceSpotMarketDataMode) -> Result<(), String> {\n    if mode == BinanceSpotMarketDataMode::Json { Ok(()) } else { Err(\"24hr ticker requires JSON market-data mode\".into()) }\n}","typeGuard":null,"tryCatchPattern":"match client.subscribe(cmd) {\n    Err(e) if e.to_string().contains(\"requires JSON market-data mode\") => {\n        log::warn!(\"restart client in JSON mode or drop ticker subscription\");\n    }\n    r => r?,\n}","preventionTips":["Align requested custom data types with the configured market-data mode at startup.","Validate strategy data requirements against adapter capabilities before launching the node.","Document which data types are SBE-only vs JSON-only for your team.","Fail fast in config loading if mode and data-type requests conflict."],"tags":["binance","configuration","subscription","spot"],"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"}