{"record":{"id":"5face668b20b6db6","repo":"nautechsystems/nautilus_trader","slug":"noid-does-not-match-new-order-oid","errorCode":null,"errorMessage":"noid '{}' does not match new order oid '{}'","messagePattern":"noid '(.+?)' does not match new order oid '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/execution.rs","lineNumber":1539,"sourceCode":"    {\n        return Some(metadata);\n    }\n\n    if let Some(cid) = order.cid\n        && let Some(client_order_id) = caches.cid_to_client_order_id.get(&cid)\n        && let Some(metadata) = caches.orders_metadata.get(&*client_order_id)\n    {\n        return Some(metadata);\n    }\n\n    None\n}\n\npub(crate) fn replacement_venue_order_id(\n    message: &crate::websocket::messages::AxWsOrderReplaced,\n) -> anyhow::Result<VenueOrderId> {\n    if message.noid != message.no.oid {\n        anyhow::bail!(\n            \"noid '{}' does not match new order oid '{}'\",\n            message.noid,\n            message.no.oid\n        );\n    }\n\n    VenueOrderId::new_checked(&message.noid).map_err(anyhow::Error::from)\n}\n\npub(crate) fn create_order_accepted(\n    order: &AxWsOrder,\n    event_ts: i64,\n    event_tn: i64,\n    caches: &OrdersCaches,\n    account_id: AccountId,\n    clock: &'static AtomicTime,\n) -> Option<OrderAccepted> {\n    let venue_order_id = VenueOrderId::new(&order.oid);","sourceCodeStart":1521,"sourceCodeEnd":1557,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/architect_ax/src/execution.rs#L1521-L1557","documentation":"When an AX order-replace event arrives, `replacement_venue_order_id` requires the message's noid to equal the new order's oid; a mismatch means the venue reported an inconsistent replace event. The adapter bails rather than mapping a VenueOrderId it cannot trust, so the event dispatch fails.","triggerScenarios":"Processing an AxWsOrderReplaced websocket message where message.noid != message.no.oid — normally only on venue-side protocol anomalies, desync, or adapter version skew with the AX API.","commonSituations":"AX gateway firmware/API changes altering replace-event semantics; corrupted or out-of-order websocket frames; bugs in adapter message parsing.","solutions":["Log and report the raw AxWsOrderReplaced payload to the adapter maintainers as a protocol inconsistency","Verify adapter and AX gateway API versions are compatible","Check for adapter parsing bugs where noid/oid fields are misread before escalating to the venue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate replace-event consistency before using the mapped id\nfn replace_event_consistent(m: &AxWsOrderReplaced) -> bool { m.noid == m.no.oid }","typeGuard":null,"tryCatchPattern":"match replacement_venue_order_id(&msg) {\n    Ok(vid) => apply_replace(vid),\n    Err(e) => {\n        log::error!(\"inconsistent AX replace event: {e}; payload={:?}\", msg);\n        // resync open-order state from venue snapshot instead of applying\n        request_order_status_snapshot().await;\n    }\n}","preventionTips":["Keep the adapter in sync with AX websocket API changes","Periodically reconcile open orders against a venue snapshot to recover from skipped events","Report persistent noid/oid mismatches to the venue/adapter maintainers"],"tags":["rust","adapter","websocket","invariant","order-replace"],"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-23T08:17:48.524Z"}