{"record":{"id":"afee878424156b44","repo":"nautechsystems/nautilus_trader","slug":"cannot-create-command-batchmodifyorders-quantity","errorCode":null,"errorMessage":"Cannot create command BatchModifyOrders: quantity, price, and trigger were either None or the same as existing values for {}","messagePattern":"Cannot create command BatchModifyOrders: quantity, price, and trigger were either None or the same as existing values for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/trading/src/strategy/mod.rs","lineNumber":534,"sourceCode":"                    updating = true;\n                }\n            }\n\n            if let Some(trigger_price) = trigger_price {\n                if !STOP_ORDER_TYPES.contains(&order.order_type()) {\n                    anyhow::bail!(\n                        \"{} orders do not have a STOP trigger price\",\n                        order.order_type()\n                    );\n                }\n\n                if Some(*trigger_price) != order.trigger_price() {\n                    updating = true;\n                }\n            }\n\n            if !updating {\n                anyhow::bail!(\n                    \"Cannot create command BatchModifyOrders: quantity, price, and trigger were \\\n                    either None or the same as existing values for {}\",\n                    order.client_order_id()\n                );\n            }\n\n            if order.is_closed() || order.is_pending_cancel() {\n                anyhow::bail!(\n                    \"Cannot create command BatchModifyOrders: state is {:?}, {order:?}\",\n                    order.status()\n                );\n            }\n        }\n\n        let params = params.filter(|params| !params.is_empty());\n        let mut modifies = Vec::with_capacity(orders.len());\n\n        for (order, (_, quantity, price, trigger_price)) in orders.into_iter().zip(updates) {","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/strategy/mod.rs#L516-L552","documentation":"For at least one order in the batch, every supplied update (quantity, price, trigger_price) was either None or already equal to the current value, so the command would be a no-op. The library refuses to emit a BatchModifyOrders command that changes nothing.","triggerScenarios":"Calling modify_orders where all Some values match current order state, or all fields are None (e.g. re-running an already-applied modify, or idempotent retry after the first modify succeeded).","commonSituations":"Idempotent retries after a timeout where the first modify already landed; computing new values from stale cached data; update struct defaults leaving all fields None.","solutions":["Check that at least one of quantity/price/trigger_price differs from the order's current value before calling","Skip orders with no effective change: if !updating { continue; } logic at the call site","Refresh order state from the cache so comparisons use current values"],"exampleFix":"// before\nstrategy.modify_orders(&orders, &updates, None, None).await?;\n// after\nlet effective: Vec<_> = orders.iter().zip(updates.iter())\n    .filter(|(o, (_, q, p, t))|\n        q.is_some_and(|q| *q != o.quantity())\n        || p.is_some_and(|p| Some(*p) != o.price())\n        || t.is_some_and(|t| Some(*t) != o.trigger_price()))\n    .collect();\nif !effective.is_empty() {\n    strategy.modify_orders(&orders, &updates, None, None).await?;\n}","handlingStrategy":"validation","validationCode":"fn has_effective_change(o: &OrderAny, q: Option<Quantity>, p: Option<Price>, t: Option<Price>) -> bool {\n    q.is_some_and(|q| q != o.quantity())\n        || p.is_some_and(|p| Some(p) != o.price())\n        || t.is_some_and(|t| Some(t) != o.trigger_price())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compare updates against fresh order state, not stale copies","Skip orders with no effective change","Refresh cache reads before computing new values","Avoid blanket retries after successful modifies"],"tags":["validation","batch-orders","no-op"],"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-14T00:17:10.932Z"}