{"record":{"id":"d1a804fe94c8bbe3","repo":"nautechsystems/nautilus_trader","slug":"binance-liquidation-custom-data-requires-binance-v","errorCode":null,"errorMessage":"Binance liquidation custom data requires BINANCE venue instrument, received {instrument_id}","messagePattern":"Binance liquidation custom data requires BINANCE venue instrument, received (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/data.rs","lineNumber":1898,"sourceCode":"                        ws.subscribe(vec![stream])\n                            .await\n                            .context(\"mark price custom subscription\")\n                    },\n                    \"mark price custom subscription\",\n                );\n            }\n            return Ok(());\n        }\n\n        if data_type != \"BinanceFuturesLiquidation\" {\n            log::warn!(\"Unsupported custom data subscription: {data_type}\");\n            return Ok(());\n        }\n\n        let instrument_id = Self::custom_liquidation_instrument_id(&cmd.data_type)?;\n        if let Some(instrument_id) = instrument_id {\n            if instrument_id.venue != self.venue() {\n                anyhow::bail!(\n                    \"Binance liquidation custom data requires BINANCE venue instrument, received {instrument_id}\"\n                );\n            }\n\n            let should_subscribe = {\n                let prev = self\n                    .force_order_refs\n                    .load()\n                    .get(&instrument_id)\n                    .copied()\n                    .unwrap_or(0);\n                self.force_order_refs.rcu(|m| {\n                    let count = m.entry(instrument_id).or_insert(0);\n                    *count += 1;\n                });\n                prev == 0\n            };\n","sourceCodeStart":1880,"sourceCodeEnd":1916,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/data.rs#L1880-L1916","documentation":"When subscribing to Binance liquidation custom data, if the DataCmd metadata specifies an instrument_id, that instrument must belong to the Binance venue this client serves. Subscribing with an instrument from another venue is rejected.","triggerScenarios":"Calling subscribe with a BinanceFuturesLiquidation data type whose metadata instrument_id has venue != self.venue() (e.g. a BINANCE_COINM instrument delivered to a USDT-M futures client).","commonSituations":"Mixing USDT-M and COIN-M instrument identifiers in configuration, or a generic subscription builder that attaches an instrument_id of the wrong venue.","solutions":["Use an instrument_id whose venue matches the data client's venue (BINANCE futures client gets .BINANCE ids, COIN-M client gets COIN-M ids)","Omit instrument_id metadata if you intend to subscribe to all liquidations for the venue","Audit config to ensure instrument suffix/venue suffix matches the adapter instance"],"exampleFix":"// before\nmetadata = {\"instrument_id\": \"BTCUSD_PERP.BINANCE_COINM\"} // on a USDT-M client\n// after\nmetadata = {\"instrument_id\": \"BTCUSDT-PERP.BINANCE\"}","handlingStrategy":"validation","validationCode":"let id: InstrumentId = /* from metadata */;\nassert_eq!(id.venue, Venue::new(\"BINANCE\"), \"instrument must match client venue\");","typeGuard":"fn is_venue_binance(id: &InstrumentId, client_venue: &Venue) -> bool {\n    &id.venue == client_venue\n}","tryCatchPattern":"match client.subscribe(cmd).await {\n    Err(e) if e.to_string().contains(\"requires BINANCE venue instrument\") => return Err(anyhow::anyhow!(\"instrument venue mismatch: {e}\")),\n    other => other,\n}","preventionTips":["Match instrument venue suffix to the data client instance","Omit instrument_id to subscribe to all liquidations","Centralize instrument id construction to avoid suffix drift"],"tags":["rust","subscription","venue-mismatch","binance"],"backgroundTag":"invalid-argument-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"}