{"record":{"id":"681273b4c88d6235","repo":"nautechsystems/nautilus_trader","slug":"ax-regular-fill-has-an-empty-order-id","errorCode":null,"errorMessage":"AX regular fill has an empty order_id","messagePattern":"AX regular fill has an empty order_id","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/http/parse.rs","lineNumber":666,"sourceCode":"\n    let trade_id = TradeId::new_checked(&fill.trade_id).context(\"Invalid trade_id in Ax fill\")?;\n    let is_block_trade = fill.is_block_trade;\n    let is_final_settlement = fill.is_final_settlement;\n    anyhow::ensure!(\n        !(is_final_settlement == Some(true) && is_block_trade == Some(false)),\n        \"AX final-settlement fill must also be classified as a block trade\"\n    );\n\n    let is_special_fill = is_block_trade == Some(true) || is_final_settlement == Some(true);\n    let venue_order_id = if is_special_fill {\n        VenueOrderId::new_checked(format!(\"AX-FILL-{}\", fill.trade_id))\n            .context(\"Invalid synthetic venue order ID for AX fill\")?\n    } else {\n        let order_id = fill\n            .order_id\n            .as_deref()\n            .context(\"AX fill is missing order_id and explicit special-fill classification\")?;\n        anyhow::ensure!(\n            !order_id.is_empty(),\n            \"AX regular fill has an empty order_id\"\n        );\n        VenueOrderId::new_checked(order_id).context(\"Invalid order_id in AX fill\")?\n    };\n\n    // Use explicit side field from fill\n    let order_side = OrderSide::from(fill.side);\n\n    let last_px = decimal_to_price_dp(fill.price, instrument.price_precision(), \"fill.price\")?;\n    let last_qty = Quantity::new(fill.quantity as f64, instrument.size_precision());\n\n    let currency = Currency::USD();\n    let commission = Money::from_decimal(fill.fee, currency)\n        .context(\"Failed to convert fill.fee Decimal to Money\")?;\n\n    let liquidity_side = if fill.is_taker {\n        LiquiditySide::Taker","sourceCodeStart":648,"sourceCodeEnd":684,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/http/parse.rs#L648-L684","documentation":"For a regular (non-special) AX fill, the venue order_id is required and must be non-empty, because the adapter maps it directly to a VenueOrderId. An empty order_id means the fill cannot be attributed to any order, so parsing is rejected rather than silently dropping the fill.","triggerScenarios":"parse_fill_report (via request_fill_reports) on a fill where is_block_trade and is_final_settlement are not Some(true) (so it takes the regular-fill path), fill.order_id is present but an empty string.","commonSituations":"Venue returns fills for orders placed outside the adapter (e.g. via the AX web UI) without an order_id, or empty-string order_id in the payload for unusual trade types; partially migrated venue data.","solutions":["Check the raw fill payload: confirm order_id is genuinely empty and the fill is not a block/final-settlement fill.","If the fill is actually a special fill, ensure the venue sets is_block_trade/is_final_settlement correctly so it takes the synthetic-ID path.","Exclude or reconcile fills without order_id manually with the venue.","If the venue legitimately omits order_id for some fill types, extend the adapter to classify them as special fills."],"exampleFix":"// before (payload)\n{ \"trade_id\": \"T9\", \"order_id\": \"\", \"is_block_trade\": null, \"is_final_settlement\": null }\n// after\n{ \"trade_id\": \"T9\", \"order_id\": \"ord-12345\", \"is_block_trade\": null, \"is_final_settlement\": null }","handlingStrategy":"validation","validationCode":"fn fill_has_order_id(f: &AxFill) -> bool {\n    f.is_block_trade == Some(true) || f.is_final_settlement == Some(true)\n        || f.order_id.as_deref().map_or(false, |s| !s.is_empty())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Skip/reconcile fills with empty order_id before parsing","Confirm special-fill flags are set for venue-side or settlement trades","Audit fills fetched for orders placed outside the adapter"],"tags":["rust","validation","fills","order-id"],"backgroundTag":"empty-required-field","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}