{"record":{"id":"7ec60e5f06f38744","repo":"nautechsystems/nautilus_trader","slug":"instrument-id-differs-across-fill-group","errorCode":null,"errorMessage":"instrument ID differs across fill group","messagePattern":"instrument ID differs across fill group","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/live/src/execution/manager.rs","lineNumber":1279,"sourceCode":"    }\n\n    fn create_orphan_fill_order_report(\n        fills: &[&FillReport],\n        instrument: &InstrumentAny,\n    ) -> anyhow::Result<OrderStatusReport> {\n        let Some(first) = fills.first() else {\n            anyhow::bail!(\"fill group is empty\");\n        };\n        let venue_position_id = first\n            .venue_position_id\n            .ok_or_else(|| anyhow::anyhow!(\"venue position ID is missing\"))?;\n\n        for fill in fills.iter().skip(1) {\n            anyhow::ensure!(\n                fill.account_id == first.account_id,\n                \"account ID differs across fill group\"\n            );\n            anyhow::ensure!(\n                fill.instrument_id == first.instrument_id,\n                \"instrument ID differs across fill group\"\n            );\n            anyhow::ensure!(\n                fill.venue_order_id == first.venue_order_id,\n                \"venue order ID differs across fill group\"\n            );\n            anyhow::ensure!(\n                fill.client_order_id == first.client_order_id,\n                \"client order ID differs across fill group\"\n            );\n            anyhow::ensure!(\n                fill.order_side == first.order_side,\n                \"order side differs across fill group\"\n            );\n            anyhow::ensure!(\n                fill.venue_position_id == first.venue_position_id,\n                \"venue position ID differs across fill group\"","sourceCodeStart":1261,"sourceCodeEnd":1297,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/execution/manager.rs#L1261-L1297","documentation":"Same consistency guard family: every fill in the group must share the instrument_id of the first fill. This fires when fills for different instruments were placed in the same group, so a single OrderStatusReport could not represent them.","triggerScenarios":"Fill reports for different instrument_ids sharing the grouping key — usually a grouping key that omits instrument_id, or venue order IDs reused across instruments.","commonSituations":"Adapters whose order IDs are only unique per instrument (common on some venues); reconciliation batches combining multiple instruments; grouping-key refactors that dropped the instrument component.","solutions":["Add instrument_id to the fill grouping key.","Confirm venue order ID uniqueness semantics and namespace by instrument if needed.","Check recent changes to reconciliation/grouping code or adapter ID mapping.","Report as a bug if stock grouping mixes instruments."],"exampleFix":"// before\nlet group_key = fill.venue_order_id;\n// after\nlet group_key = (fill.instrument_id, fill.venue_order_id);","handlingStrategy":"validation","validationCode":"anyhow::ensure!(fills.iter().all(|f| f.instrument_id == fills[0].instrument_id), \"mixed instruments in group\");","typeGuard":"fn single_instrument(fills: &[&FillReport]) -> bool { fills.iter().all(|f| f.instrument_id == fills.first().unwrap().instrument_id) }","tryCatchPattern":"if let Err(e) = create_orphan_fill_order_report(&fills, &instrument) { log::error!(\"fill group inconsistent: {e}\"); return; }","preventionTips":["Include instrument_id in every fill grouping key","Namespace venue order IDs by instrument when the venue reuses IDs","Review grouping-key changes in reconciliation code before deploying"],"tags":["rust","fills","instrument-id","reconciliation"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}