{"record":{"id":"d2a1f20c97b19f74","repo":"nautechsystems/nautilus_trader","slug":"generate-order-status-report-requires-instrument-i-d2a1f2","errorCode":null,"errorMessage":"generate_order_status_report requires instrument_id","messagePattern":"generate_order_status_report requires instrument_id","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/execution/reports.rs","lineNumber":522,"sourceCode":"                    log::warn!(\"Failed to query order {venue_order_id_str}: {e}\");\n                }\n            }\n            Ok(())\n        });\n    }\n\n    pub(super) async fn generate_order_status_report_impl(\n        &self,\n        cmd: &GenerateOrderStatusReport,\n    ) -> anyhow::Result<Option<OrderStatusReport>> {\n        let Some(venue_order_id) =\n            self.resolve_venue_order_id(cmd.venue_order_id, cmd.client_order_id)\n        else {\n            anyhow::bail!(\"generate_order_status_report requires venue_order_id\");\n        };\n\n        let Some(instrument_id) = cmd.instrument_id else {\n            anyhow::bail!(\"generate_order_status_report requires instrument_id\");\n        };\n\n        let authority = self.resolve_target_order_authority(\n            cmd.client_order_id,\n            venue_order_id,\n            Some(instrument_id),\n        )?;\n        let cached_authority = authority\n            .client_order_id\n            .map(|_| authority.require_cached_base_limit(venue_order_id).cloned())\n            .transpose()?;\n        let instrument = self\n            .core\n            .cache()\n            .instrument(&instrument_id)\n            .cloned()\n            .with_context(|| format!(\"instrument {instrument_id} not cached\"))?;\n        let size_prec = instrument.size_precision();","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/execution/reports.rs#L504-L540","documentation":"After resolving the venue order id, generate_order_status_report_impl also requires an instrument_id to resolve the target order authority and route the query. A GenerateOrderStatusReport without instrument_id is rejected before contacting the venue.","triggerScenarios":"Calling generate_order_status_report with venue_order_id (or resolvable client_order_id) set but cmd.instrument_id left as None.","commonSituations":"Building the request from a partial record where instrument metadata was not persisted; generic status-polling code that fills order ids but not the instrument; copying a request struct between markets without updating instrument_id.","solutions":["Set cmd.instrument_id to the Nautilus instrument id the order belongs to.","Derive instrument_id from the stored order or prior report before requesting a status update.","Ensure your persistence layer records instrument_id alongside venue_order_id."],"exampleFix":"// before\nlet cmd = GenerateOrderStatusReport { venue_order_id: Some(vid), ..Default::default() };\n// after\nlet cmd = GenerateOrderStatusReport { venue_order_id: Some(vid), instrument_id: Some(instrument_id), ..Default::default() };","handlingStrategy":"validation","validationCode":"// Rust: require instrument_id before building the request\nfn status_cmd_has_instrument(cmd: &GenerateOrderStatusReport) -> bool {\n    cmd.instrument_id.is_some()\n}\nassert!(status_cmd_has_instrument(&cmd));","typeGuard":"fn with_instrument(cmd: GenerateOrderStatusReport, instrument_id: InstrumentId) -> GenerateOrderStatusReport {\n    GenerateOrderStatusReport { instrument_id: Some(instrument_id), ..cmd }\n}","tryCatchPattern":null,"preventionTips":["Store instrument_id alongside venue_order_id in your order records.","Use a constructor/builder that makes instrument_id mandatory for status requests.","Audit any code path that copies report requests between instruments."],"tags":["polymarket","order-status","missing-argument","rust"],"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-14T05:17:10.506Z"}