{"record":{"id":"b7b76ff5a3389202","repo":"nautechsystems/nautilus_trader","slug":"partitioned-cancel-failed","errorCode":null,"errorMessage":"partitioned cancel failed: {}","messagePattern":"partitioned cancel failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/execution/mod.rs","lineNumber":1179,"sourceCode":"                                &emitter,\n                                clock,\n                                &msg,\n                            );\n                        }\n                        errors.push(msg);\n                    }\n                }\n            }\n            Err(e) => {\n                let msg = format!(\"Failed to build long-term cancel messages: {e:?}\");\n                log::error!(\"{msg}\");\n                errors.push(msg);\n            }\n        }\n    }\n\n    if !errors.is_empty() {\n        anyhow::bail!(\"partitioned cancel failed: {}\", errors.join(\"; \"));\n    }\n\n    Ok(())\n}\n\nfn emit_partitioned_cancel_rejections(\n    orders: &[DydxCancelOrderRequest],\n    emitter: &ExecutionEventEmitter,\n    clock: &AtomicTime,\n    reason: &str,\n) {\n    for order in orders {\n        emitter.emit_order_cancel_rejected_event(\n            order.strategy_id,\n            order.instrument_id,\n            order.client_order_id,\n            order.venue_order_id,\n            reason,","sourceCodeStart":1161,"sourceCodeEnd":1197,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/execution/mod.rs#L1161-L1197","documentation":"This error aggregates all individual cancellation failures from a partitioned (chunked) batch cancel broadcast on the dYdX adapter. `broadcast_partitioned_cancels` collects per-partition error messages into a vector and, if any failed, bails with all messages joined by '; ' so the caller (cancel_all_orders or batch_cancel_orders) sees the complete failure set at once.","triggerScenarios":"Calling `cancel_all_orders` or `batch_cancel_orders` when one or more partitioned broadcast chunks fail (e.g. TX broadcast rejected on-chain, block height stale, order encoding missing for some orders).","commonSituations":"Canceling many open orders during network congestion where some tx broadcasts are rejected; canceling orders whose client order IDs were never encoded by this client instance; node outages affecting only some partitions.","solutions":["Inspect the joined error messages to identify which partitions/orders failed","Retry cancellation for the failed orders once connectivity is restored","Verify the block time monitor has a current block height before mass-canceling","Check node/validator health and gas settings if broadcast rejections persist"],"exampleFix":"// before: blindly retrying everything\nclient.cancel_all_orders(cmd).await?;\n// after: parse per-partition failures and retry selectively\nif let Err(e) = client.cancel_all_orders(cmd) {\n    for part in e.to_string().split(\"; \") {\n        log::warn!(\"partition failure: {part}\");\n    }\n    // re-issue cancels for the affected orders\n}","handlingStrategy":"try-catch","validationCode":"if !client.is_connected() { skip_mass_cancel(); }","typeGuard":null,"tryCatchPattern":"match client.cancel_all_orders(cmd) {\n    Err(e) => {\n        let failed: Vec<&str> = e.to_string().split(\"; \").collect();\n        for f in failed { log::warn!(\"retry needed: {f}\"); }\n    }\n    Ok(_) => {}\n}","preventionTips":["Only mass-cancel while connected and block height is fresh","Log per-partition results so partial failures are visible","Retry failed partitions individually after transient errors"],"tags":["dydx","order-cancellation","batch-operation","broadcast"],"backgroundTag":"api-error-response","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"}