nautechsystems/nautilus_trader · error · anyhow::Error
partitioned cancel failed: {}
Error message
partitioned cancel failed: {} What it means
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.
Source
Thrown at crates/adapters/dydx/src/execution/mod.rs:1179
&emitter,
clock,
&msg,
);
}
errors.push(msg);
}
}
}
Err(e) => {
let msg = format!("Failed to build long-term cancel messages: {e:?}");
log::error!("{msg}");
errors.push(msg);
}
}
}
if !errors.is_empty() {
anyhow::bail!("partitioned cancel failed: {}", errors.join("; "));
}
Ok(())
}
fn emit_partitioned_cancel_rejections(
orders: &[DydxCancelOrderRequest],
emitter: &ExecutionEventEmitter,
clock: &AtomicTime,
reason: &str,
) {
for order in orders {
emitter.emit_order_cancel_rejected_event(
order.strategy_id,
order.instrument_id,
order.client_order_id,
order.venue_order_id,
reason,View on GitHub (pinned to 18893faf8b)
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
Example fix
// before: blindly retrying everything
client.cancel_all_orders(cmd).await?;
// after: parse per-partition failures and retry selectively
if let Err(e) = client.cancel_all_orders(cmd) {
for part in e.to_string().split("; ") {
log::warn!("partition failure: {part}");
}
// re-issue cancels for the affected orders
} Defensive patterns
Strategy: try-catch
Validate before calling
if !client.is_connected() { skip_mass_cancel(); } Try / catch
match client.cancel_all_orders(cmd) {
Err(e) => {
let failed: Vec<&str> = e.to_string().split("; ").collect();
for f in failed { log::warn!("retry needed: {f}"); }
}
Ok(_) => {}
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Cannot cancel order: not connected
- Client order ID not found in cache
- Cannot cancel orders: not connected
- Transaction broadcast failed: code={}, log={}
- Broadcast semaphore closed: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/b7b76ff5a3389202.
Report an issue: GitHub.