nautechsystems/nautilus_trader · error · anyhow::Error
Pending {ord_type:?} algo order pagination for {inst_type:?}
Error message
Pending {ord_type:?} algo order pagination for {inst_type:?} did not establish complete coverage What it means
When require_complete_active_coverage is set, pending algo order pagination must sweep every page (pagination complete flag true). If OKX pagination ended early (e.g. hitting the limit or losing cursor continuity), the adapter raises this error rather than returning a possibly incomplete set of live algo orders.
Source
Thrown at crates/adapters/okx/src/http/client.rs:6767
let mut params = params_builder
.build()
.map_err(|e| anyhow::anyhow!(format!("Failed to build algo order params: {e}")))?;
if query_pending {
let remaining = limit.map(|l| (l as usize).saturating_sub(reports.len()));
let pending_sweep = match self
.paginate_algo_pending(¶ms, remaining, require_complete_active_coverage)
.await
{
Ok(sweep) => sweep,
Err(e) if require_complete_active_coverage => {
return Err(OKXPendingAlgoOrderReportsError::new(e).into());
}
Err(e) => return Err(e),
};
if require_complete_active_coverage && !pending_sweep.complete {
return Err(OKXPendingAlgoOrderReportsError::new(anyhow::anyhow!(
"Pending {ord_type:?} algo order pagination for {inst_type:?} did not establish complete coverage"
))
.into());
}
complete &= pending_sweep.complete;
let mut pending = pending_sweep.items;
if let Some(state) = state {
pending.retain(|order| order.state == state);
}
let pending_reports_complete = match self
.collect_algo_reports(
account_id,
&pending,
require_complete_active_coverage,
&mut instruments_cache,
ts_init,View on GitHub (pinned to 18893faf8b)
Solutions
- Increase the limit / allow more pages so the sweep can finish
- Retry the sweep; transient pagination gaps can resolve on retry
- Set require_complete_active_coverage=false only if partial views are acceptable
- Sweep per instrument_type to reduce result volume per pass
Example fix
// before reports(client, ord_type, inst_type, Some(100), /*require_complete*/ true) // after reports(client, ord_type, inst_type, None, true) // no artificial cap, allow full sweep
Defensive patterns
Strategy: retry
Validate before calling
// pre-check: size the pending book against your limit allowance
let est = account_pending_algo_count();
if require_complete && est > limit.unwrap_or(usize::MAX) {
return Err("limit too small for complete coverage".into());
} Try / catch
match client.algo_order_reports(...).await {
Err(e) if e.to_string().contains("did not establish complete coverage") => {
backoff_retry(|| client.algo_order_reports(...), 3).await?
}
other => other?,
} Prevention
- Avoid artificial small limits when require_complete_active_coverage=true
- Retry sweeps before failing reconciliation
- Only relax the completeness flag when partial data is explicitly acceptable
When it happens
Trigger: Calling the algo order reports sweep with require_complete_active_coverage=true while pending-sweep returns complete=false, typically when the limit cap truncates the pending pages or OKX paginates across more records than the allowance.
Common situations: Reconciliation of live algo orders with strict coverage on an account with many pending algo orders and a small limit; transient OKX pagination inconsistencies.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- Pending {ord_type:?} algo order reports for {inst_type:?} co
- Conditional order types must use OKXAlgoOrderType
- Binance Futures open algo order has unresolved instrument {i
- actual order ID mismatch: expected {expected_actual_order_id
- actual order symbol mismatch: expected {}, was {}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/af3411768994fe21.
Report an issue: GitHub.