{"record":{"id":"7b9d4dd44f1c2be3","repo":"nautechsystems/nautilus_trader","slug":"cannot-subscribe-for-synthetic-instrument-orderbo-7b9d4d","errorCode":null,"errorMessage":"Cannot subscribe for synthetic instrument `OrderBookDepth10` data","messagePattern":"Cannot subscribe for synthetic instrument `OrderBookDepth10` data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/mod.rs","lineNumber":3136,"sourceCode":"        // Validate parent shape BEFORE mutating subscription state so a parse\n        // failure leaves the engine bookkeeping unchanged.\n        let parent = resolve_parent_components(&cmd.instrument_id, cmd.params.as_ref())?;\n\n        let had_deltas =\n            self.has_book_delta_subscription_key(cmd.instrument_id, cmd.client_id, cmd.venue);\n\n        if cmd.managed {\n            self.setup_book_updater(&cmd.instrument_id, cmd.book_type, true, parent)?;\n        }\n\n        self.increment_book_delta_subscription(cmd.instrument_id, cmd.client_id, cmd.venue);\n\n        Ok(!had_deltas)\n    }\n\n    fn subscribe_book_depth10(&mut self, cmd: &SubscribeBookDepth10) -> anyhow::Result<bool> {\n        if cmd.instrument_id.is_synthetic() {\n            anyhow::bail!(\"Cannot subscribe for synthetic instrument `OrderBookDepth10` data\");\n        }\n\n        let parent = resolve_parent_components(&cmd.instrument_id, cmd.params.as_ref())?;\n        let had_depth10 =\n            self.has_book_depth10_subscription_key(cmd.instrument_id, cmd.client_id, cmd.venue);\n\n        if cmd.managed {\n            self.setup_book_updater(&cmd.instrument_id, cmd.book_type, false, parent)?;\n        }\n\n        self.increment_book_depth10_subscription(cmd.instrument_id, cmd.client_id, cmd.venue);\n\n        Ok(!had_depth10)\n    }\n\n    fn subscribe_book_snapshots(&mut self, cmd: &SubscribeBookSnapshots) -> anyhow::Result<()> {\n        if cmd.instrument_id.is_synthetic() {\n            anyhow::bail!(\"Cannot subscribe for synthetic instrument `OrderBookDelta` data\");","sourceCodeStart":3118,"sourceCodeEnd":3154,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/mod.rs#L3118-L3154","documentation":"subscribe_book_depth10 rejects OrderBookDepth10 subscriptions for synthetic instrument IDs. Depth-10 book data is sourced from a venue data client and cannot exist for a locally computed synthetic instrument, so the engine bails before mutating any subscription state.","triggerScenarios":"Calling DataEngine.subscribe_book_depth10 with a cmd.instrument_id where is_synthetic() is true — typically a SyntheticInstrument-generated ID passed into a depth subscription command.","commonSituations":"Configuring depth-10 book feeds with a synthetic instrument ID by mistake; templated strategy configs that substitute the traded instrument without filtering synthetic IDs.","solutions":["Subscribe to OrderBookDepth10 only with real venue instrument IDs","Guard with instrument_id.is_synthetic() before issuing the depth10 subscription","Use synthetic instrument data APIs for computed prices rather than book depth","Audit config files for synthetic '=' ID notation in book-depth instrument fields"],"exampleFix":"// before\nengine.subscribe_book_depth10(SubscribeBookDepth10::new(synthetic_id, client_id, venue));\n// after\nif !synthetic_id.is_synthetic() {\n    engine.subscribe_book_depth10(SubscribeBookDepth10::new(synthetic_id, client_id, venue));\n}","handlingStrategy":"validation","validationCode":"if instrument_id.is_synthetic() {\n    return Ok(()); // depth10 data only exists for venue instruments\n}","typeGuard":"fn is_book_capable(id: &InstrumentId) -> bool {\n    !id.is_synthetic()\n}","tryCatchPattern":"if let Err(e) = engine.subscribe_book_depth10(&cmd) {\n    if e.to_string().contains(\"synthetic\") { log::error!(\"invalid depth10 target: {e}\"); }\n    else { return Err(e.into()); }\n}","preventionTips":["Audit depth-feed configs for synthetic '=' instrument IDs","Gate book subscriptions behind a real-instrument check","Keep a single helper for validating subscription targets"],"tags":["rust","data-engine","order-book","synthetic-instrument"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}