{"record":{"id":"52263eeffceee4f4","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-for-update-order","errorCode":null,"errorMessage":"Unsupported order type {} for update_order","messagePattern":"Unsupported order type (.+?) for update_order","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/execution/src/matching_engine/mod.rs","lineNumber":6112,"sourceCode":"                    ModifyOutcome::Applied\n                }\n            }\n            OrderAny::TrailingStopLimit(_) => {\n                match (\n                    price.or(order.price()),\n                    trigger_price.or(order.trigger_price()),\n                ) {\n                    (Some(price), Some(trigger_price)) => {\n                        self.update_limit_if_touched_order(order, quantity, price, trigger_price)\n                    }\n                    _ => {\n                        self.generate_order_updated(order, quantity, price, trigger_price, None);\n                        ModifyOutcome::Applied\n                    }\n                }\n            }\n            _ => {\n                panic!(\n                    \"Unsupported order type {} for update_order\",\n                    order.order_type()\n                );\n            }\n        };\n\n        if outcome == ModifyOutcome::Rejected {\n            return false;\n        }\n\n        // If order now has zero leaves after update, cancel it\n        let new_leaves_qty = quantity.saturating_sub(filled_qty);\n        if new_leaves_qty.is_zero() {\n            if self.config.support_contingent_orders\n                && order.contingency_type().is_some()\n                && update_contingencies\n            {\n                self.update_contingent_order(order, quantity);","sourceCodeStart":6094,"sourceCodeEnd":6130,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/execution/src/matching_engine/mod.rs#L6094-L6130","documentation":"The matching engine's update_order (order modify) routine reached a catch-all match arm for an order type it does not support modifying. Only certain order types (e.g. Limit, Stop-Market/Limit with modifiable fields) support update; anything else panics. The requested modify operation is incompatible with the order's type.","triggerScenarios":"Calling update_order (via OrderEmulator/MatchingEngine modify path, e.g. handling an OrderModify or MODIFY command) on an order whose order_type() is not one of the handled modifiable types — e.g. Market, Market-To-Limit, or other types hitting the `_` arm.","commonSituations":"Submitting a modify request for price/quantity on a Market order; an emulator or strategy modifying an order type changed after partial fills/conversion; adapter forwarding venue amend requests for unsupported order types.","solutions":["Only send modify/update commands for order types that support it (typically Limit and Stop orders); cancel-and-resubmit for others.","Check order.order_type() before calling update_order and route unsupported types to cancel+submit.","Fix strategy logic that assumes all order types can be amended.","Update the adapter to reject amend requests for unsupported types upstream of the matching engine."],"exampleFix":"// before\nengine.update_order(&order, new_qty, new_price, trigger);\n// after\nmatch order.order_type() {\n    OrderType::Limit | OrderType::StopLimit => engine.update_order(&order, new_qty, new_price, trigger),\n    _ => { engine.cancel_order(&order); engine.submit(new_order_with(new_qty, new_price)); }\n}","handlingStrategy":"validation","validationCode":"const MODIFIABLE: &[OrderType] = &[OrderType::Limit, OrderType::StopLimit, OrderType::StopMarket];\nif !MODIFIABLE.contains(&order.order_type()) {\n    // route to cancel + resubmit instead of update_order\n}","typeGuard":"fn is_modifiable(order: &OrderAny) -> bool {\n    matches!(order.order_type(), OrderType::Limit | OrderType::StopLimit | OrderType::StopMarket)\n}","tryCatchPattern":null,"preventionTips":["Only amend Limit/Stop order types; use cancel-and-resubmit for everything else.","Centralize modify logic in one helper that checks order_type first.","Have adapters reject unsupported amend requests before they reach the engine.","Review strategies that modify orders after partial fills, where type conversions may occur."],"tags":["rust","matching-engine","order-modify","panic"],"backgroundTag":"unsupported-operation","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"}