{"record":{"id":"0bbdc36352c0f3de","repo":"nautechsystems/nautilus_trader","slug":"cannot-modify-order-in-place-orders-do-not-hav-0bbdc3","errorCode":null,"errorMessage":"Cannot modify order in place: {} orders do not have a STOP trigger price","messagePattern":"Cannot modify order in place: (.+?) orders do not have a STOP trigger price","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/trading/src/algorithm/mod.rs","lineNumber":1031,"sourceCode":"    {\n        // Validate order status\n        let status = order.status();\n        if status != OrderStatus::Initialized && status != OrderStatus::Released {\n            anyhow::bail!(\n                \"Cannot modify order in place: status is {status:?}, expected INITIALIZED or RELEASED\"\n            );\n        }\n\n        // Validate order type compatibility\n        if price.is_some() && order.price().is_none() {\n            anyhow::bail!(\n                \"Cannot modify order in place: {} orders do not have a LIMIT price\",\n                order.order_type()\n            );\n        }\n\n        if trigger_price.is_some() && order.trigger_price().is_none() {\n            anyhow::bail!(\n                \"Cannot modify order in place: {} orders do not have a STOP trigger price\",\n                order.order_type()\n            );\n        }\n\n        // Check if any value would actually change\n        let qty_changing = quantity.is_some_and(|q| q != order.quantity());\n        let price_changing = price.is_some() && price != order.price();\n        let trigger_changing = trigger_price.is_some() && trigger_price != order.trigger_price();\n\n        if !qty_changing && !price_changing && !trigger_changing {\n            anyhow::bail!(\"Cannot modify order in place: no parameters differ from current values\");\n        }\n\n        let core = ExecutionAlgorithmNative::exec_algorithm_core_mut(self);\n        let ts_now = core.clock_mut().timestamp_ns();\n\n        let updated = OrderUpdated::new(","sourceCodeStart":1013,"sourceCodeEnd":1049,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/algorithm/mod.rs#L1013-L1049","documentation":"When modifying an order in place with a trigger_price, the order must actually possess a STOP trigger price field (i.e. be a stop-type order). Orders whose type has no trigger price (e.g. plain LIMIT/MARKET) cannot accept one, so the call bails.","triggerScenarios":"Calling modify_order_in_place(order, qty, price, Some(trigger_price)) on a non-stop order type such as Limit or Market.","commonSituations":"Generic modification code that always passes a trigger price; converting a limit order to a stop order via modify instead of creating a new order; misconfigured algorithm parameters supplying trigger prices for non-stop orders.","solutions":["Only pass trigger_price for order types that support trigger prices (STOP_LIMIT, STOP_MARKET, etc.)","Check order.trigger_price().is_some() before supplying a new trigger price","Create a new order of the correct type instead of trying to add a trigger via modification","Inspect order.order_type() and branch the modification logic accordingly"],"exampleFix":"// before\nalgo.modify_order_in_place(&mut order, None, None, Some(trigger))?;\n// after\nif order.trigger_price().is_some() {\n    algo.modify_order_in_place(&mut order, None, None, Some(trigger))?;\n}","handlingStrategy":"validation","validationCode":"if trigger_price.is_some() && order.trigger_price().is_none() { return Err(anyhow!(\"order type {:?} has no trigger price\", order.order_type())); }","typeGuard":"fn supports_trigger(o: &OrderAny) -> bool { o.trigger_price().is_some() }","tryCatchPattern":null,"preventionTips":["Branch on order_type before supplying trigger_price","Create a new stop-type order rather than adding a trigger via modification"],"tags":["rust","orders","execution-algorithm"],"backgroundTag":"invalid-argument-value","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"}