{"record":{"id":"140a53447d25ea6c","repo":"nautechsystems/nautilus_trader","slug":"orderlist-denied-duplicate-order-list-id","errorCode":null,"errorMessage":"OrderList denied: duplicate {order_list.id}","messagePattern":"OrderList denied: duplicate (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/trading/src/strategy/mod.rs","lineNumber":272,"sourceCode":"            core.order_factory().create_list(&mut orders, ts_init)\n        };\n\n        if let Err(e) = order_list.validate() {\n            log::error!(\"OrderList denied: {e}\");\n            anyhow::bail!(\"OrderList denied: {e}\");\n        }\n\n        {\n            let cache_rc = core.cache_rc();\n            let mut cache = cache_rc.try_borrow_mut().map_err(|_| {\n                anyhow::anyhow!(\n                    \"Cannot submit order list {}: cache is currently borrowed\",\n                    order_list.id\n                )\n            })?;\n\n            if cache.order_list_exists(&order_list.id) {\n                anyhow::bail!(\"OrderList denied: duplicate {}\", order_list.id);\n            }\n\n            for order in &orders {\n                if cache.order_exists(&order.client_order_id()) {\n                    anyhow::bail!(\n                        \"Order in list denied: duplicate {}\",\n                        order.client_order_id()\n                    );\n                }\n            }\n\n            cache.add_order_list(order_list.clone())?;\n            for order in &orders {\n                cache.add_order(order.clone(), position_id, client_id, true)?;\n            }\n        }\n\n        for order in &orders {","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/strategy/mod.rs#L254-L290","documentation":"When submitting an order list, the strategy checks `cache.order_list_exists(&order_list.id)`; if a list with the same ID is already in the cache the submission is rejected with `OrderList denied: duplicate {order_list.id}`. This guards against submitting the same logical order list twice (double-fire of the same request).","triggerScenarios":"Calling `submit_order_list` twice with the same OrderList / same client_order_id set — e.g. retrying a submission after an error, or calling submit from both a handler and a timer for the same list object.","commonSituations":"Retry logic that re-submits the original list after a transient failure without creating a new one; duplicate signal processing creating identical lists; replayed events in backtests resubmitting historical orders; code path that submits on both on_data and on_bar for the same condition.","solutions":["Check `self.cache.order_list_exists(order_list.id)` before submitting, or make the call idempotent.","On retry, create a fresh order list via the OrderFactory so new client_order_ids are generated.","Deduplicate your signal/event source so the same condition does not trigger submission twice.","Log the order_list.id on submission and skip if it matches the last submitted list."],"exampleFix":"// before\nself.submit_order_list(order_list)  # called again on retry -> duplicate\n// after\nif not self.cache.order_list_exists(order_list.id):\n    self.submit_order_list(order_list)\nelse:\n    self.log.warning(f'Order list {order_list.id} already submitted')","handlingStrategy":"validation","validationCode":"if self.cache.order_list_exists(order_list.id):\n    self.log.warning(f'{order_list.id} already submitted — skipping')\nelse:\n    self.submit_order_list(order_list)","typeGuard":"def can_submit_order_list(strategy, order_list):\n    return not strategy.cache.order_list_exists(order_list.id)","tryCatchPattern":"try:\n    if not self.cache.order_list_exists(order_list.id):\n        self.submit_order_list(order_list)\nexcept Exception as e:\n    self.log.error(f'Order list submission failed: {e}')","preventionTips":["Check cache.order_list_exists before every submission","Create a fresh list (new client_order_ids) for retries rather than resubmitting","Deduplicate signals/events that trigger submission","Track submitted list IDs in strategy state as a second guard"],"tags":["order-list","duplicate","idempotency","orders"],"backgroundTag":"entity-already-exists","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"}