{"record":{"id":"f2665cc3fd3fbe04","repo":"nautechsystems/nautilus_trader","slug":"venue-position-id-is-missing","errorCode":null,"errorMessage":"venue position ID is missing","messagePattern":"venue position ID is missing","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/live/src/execution/manager.rs","lineNumber":1272,"sourceCode":"            \"Reconciliation complete for {venue}: reconciled={orders_reconciled}, external={external_orders_created}, open={open_orders_initialized}, fills={fills_applied}, positions={positions_created}, skipped={orders_skipped_duplicate}, filtered={orders_skipped_filtered}\",\n        );\n\n        ReconciliationResult {\n            events,\n            external_orders,\n        }\n    }\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            );","sourceCodeStart":1254,"sourceCodeEnd":1290,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/execution/manager.rs#L1254-L1290","documentation":"When building an orphan-fill OrderStatusReport, each FillReport must carry a venue_position_id (needed to attribute the synthetic order report to a position). This error is raised when the first fill in the group has None for that field, so a coherent report cannot be constructed.","triggerScenarios":"A FillReport with venue_position_id = None reaches create_orphan_fill_order_report — typically from venues/adapters that do not populate position IDs on fill reports, or from netting venues where position ID is optional.","commonSituations":"Adapters that omit venue position IDs in fill data; venue API changes removing/renaming the position ID field; reconciliation over fills from a venue that never reports position IDs.","solutions":["Ensure the adapter populates venue_position_id on all FillReports it generates.","If the venue never provides position IDs, skip the orphan-fill grouping path for those fills instead of treating it as an error.","Check for recent venue API/adapter version changes that dropped the field.","Report as a bug if the adapter is supposed to always set it."],"exampleFix":"// before\nlet venue_position_id = first.venue_position_id.ok_or_else(|| anyhow!(\"venue position ID is missing\"))?;\n// after\nlet Some(venue_position_id) = first.venue_position_id else {\n    log::warn!(\"fill has no venue position ID; skipping orphan fill grouping\");\n    return Ok(());\n};","handlingStrategy":"validation","validationCode":"if fills.first().and_then(|f| f.venue_position_id).is_none() { log::warn!(\"fill lacks venue_position_id; skipping orphan grouping\"); return Ok(()); }","typeGuard":"fn has_position_id(f: &FillReport) -> bool { f.venue_position_id.is_some() }","tryCatchPattern":"match create_orphan_fill_order_report(&fills, &instrument) { Err(e) if e.to_string().contains(\"position ID is missing\") => log::warn!(\"adapter missing venue_position_id\"), Err(e) => return Err(e), Ok(r) => {/* use r */} }","preventionTips":["Ensure adapters always populate venue_position_id on fills","Skip orphan-fill grouping for venues that never report position IDs","Watch for venue API changes that drop the field"],"tags":["rust","fills","position-id","reconciliation"],"backgroundTag":"missing-required-argument","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"}