{"record":{"id":"74cacd457e6d2b64","repo":"nautechsystems/nautilus_trader","slug":"provider-venue-order-does-not-match-requested-v","errorCode":null,"errorMessage":"provider venue order {} does not match requested venue order {venue_order_id}","messagePattern":"provider venue order (.+?) does not match requested venue order (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/execution/reconciliation.rs","lineNumber":586,"sourceCode":"}\n\nfn build_order_report_from_order(\n    order: &PolymarketOpenOrder,\n    instruments: &AtomicMap<Ustr, InstrumentAny>,\n    ctx: &FillContext<'_>,\n    scope: OrderEvidenceScope<'_>,\n    ts_init: UnixNanos,\n    load_ids: Option<&[InstrumentId]>,\n) -> anyhow::Result<OrderRowResult> {\n    let collection_load_ids = match scope {\n        OrderEvidenceScope::Collection {\n            instrument_filter: None,\n        } => load_ids,\n        _ => None,\n    };\n\n    if let OrderEvidenceScope::Target { venue_order_id, .. } = scope {\n        anyhow::ensure!(\n            order.id == venue_order_id.as_str(),\n            \"provider venue order {} does not match requested venue order {venue_order_id}\",\n            order.id,\n        );\n    }\n\n    if !is_owned_by_account(\n        &order.maker_address,\n        &order.owner,\n        ctx.user_address,\n        ctx.api_key,\n    ) {\n        return match scope {\n            OrderEvidenceScope::Collection { .. } => {\n                log::debug!(\"Dropping open order {} not owned by the account\", order.id);\n                Ok(OrderRowResult {\n                    report: None,\n                    counted_filtered: true,","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/execution/reconciliation.rs#L568-L604","documentation":"When building an order report for a specific target venue order, the adapter asserts that the provider order row it received is actually the requested venue order id. This error means the venue/API returned a row for a different order id than the one requested, i.e. an internal lookup/identity inconsistency during reconciliation.","triggerScenarios":"Calling build_target_order_report (via order status report generation for a specific VenueOrderId) when the resolved `PolymarketOpenOrder.id` does not equal `scope.venue_order_id`. Happens if the provider lookup keyed on something other than the exact order id (e.g. hash/market+asset lookup returning the wrong row) or if the caller passes an incorrect venue_order_id.","commonSituations":"Multiple open orders on the same market token and the API list filtered imprecisely; venue_order_id formatting differences (checksum vs raw id, case); a custom strategy translating client order ids to venue ids incorrectly; adapter version changes in how order ids are derived from Polymarket's order hash.","solutions":["Verify the venue_order_id passed to the reconciliation/request matches exactly the Polymarket order id (string equality, no whitespace/case differences).","Re-fetch the single order by id from the provider instead of scanning a list, ensuring the request filters on the exact id.","Check that client-to-venue order id mapping is stable across restarts and adapter versions.","If the provider consistently returns the wrong row, report the mismatch with both ids; the row is unusable for this target."],"exampleFix":"// before: finding the order in a list by market instead of exact id\nlet order = orders.iter().find(|o| o.market == market)?;\n// after: match on the exact venue order id\nlet order = orders.into_iter().find(|o| o.id == venue_order_id.as_str())\n    .with_context(|| format!(\"order {venue_order_id} not in provider rows\"))?;","handlingStrategy":"validation","validationCode":"let order = client.get_order(&venue_order_id).await?;\nif order.id != venue_order_id.as_str() {\n    return Err(anyhow!(\"provider returned {} for requested {venue_order_id}\", order.id));\n}","typeGuard":"fn is_target_row(order: &PolymarketOpenOrder, wanted: &VenueOrderId) -> bool {\n    order.id == wanted.as_str()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"does not match requested venue order\") => {\n        log::error!(\"venue row identity mismatch; re-fetch order by exact id\");\n        reconcile_by_exact_id(&venue_order_id).await?;\n    }\n    other => other?,\n}","preventionTips":["Pass venue order ids exactly as produced by the venue (no trimming/casing).","Fetch single orders by exact id rather than filtering lists by market/asset.","Maintain a stable client_order_id -> venue_order_id mapping in persistent storage."],"tags":["reconciliation","order-management","identity-mismatch","polymarket"],"backgroundTag":"invalid-identifier","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"}