nautechsystems/nautilus_trader · error · anyhow::Error

Pending {ord_type:?} algo order reports for {inst_type:?} co

Error message

Pending {ord_type:?} algo order reports for {inst_type:?} could not be completely converted

What it means

Related to 3508 but at the conversion stage: converting raw OKX pending algo order reports into adapter report types reported incomplete conversion coverage (pending_reports_complete=false). With require_complete_active_coverage=true this is escalated to an error, since some live algo orders could not be represented.

Source

Thrown at crates/adapters/okx/src/http/client.rs:6802

                        &mut instruments_cache,
                        ts_init,
                        start_ns,
                        end_ns,
                        &mut seen,
                        &mut reports,
                        &mut ambiguous_triggered_child_ids,
                    )
                    .await
                {
                    Ok(complete) => complete,
                    Err(e) if require_complete_active_coverage => {
                        return Err(OKXPendingAlgoOrderReportsError::new(e).into());
                    }
                    Err(e) => return Err(e),
                };

                if require_complete_active_coverage && !pending_reports_complete {
                    return Err(OKXPendingAlgoOrderReportsError::new(anyhow::anyhow!(
                        "Pending {ord_type:?} algo order reports for {inst_type:?} could not be completely converted"
                    ))
                    .into());
                }
                complete &= pending_reports_complete;

                if let Some(lim) = limit
                    && reports.len() >= lim as usize
                {
                    reports.truncate(lim as usize);
                    return Ok(AlgoOrderReportSweep {
                        reports,
                        complete,
                        ambiguous_triggered_child_ids,
                    });
                }
            }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Update/extend conversion logic to cover the failing algo order type
  2. Inspect wrapped OKXPendingAlgoOrderReportsError for the item-level cause
  3. Retry the sweep to rule out transient malformed responses
  4. Drop require_complete_active_coverage only when partial results are acceptable

Example fix

// before
match convert_pending(raw) { ... Err(_) => complete = false }
// after
match convert_pending(raw) { Err(e) => return Err(OKXPendingAlgoOrderReportsError::new(e).into()), ... }
Defensive patterns

Strategy: try-catch

Try / catch

match client.algo_order_reports(...).await {
    Err(e) if e.to_string().contains("could not be completely converted") => {
        let cause = OKXPendingAlgoOrderReportsError::from_err(&e);
        log_unconverted(cause); // inspect and extend converter
    }
    other => other?,
}

Prevention

When it happens

Trigger: Pending algo reports conversion loop signals incomplete (e.g. unknown ord_type payloads, per-item conversion errors) while strict coverage is required.

Common situations: New or exotic OKX algo order types the converter does not yet support; malformed/missing fields in OKX responses during exchange API changes.

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


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/db11e2ce92e1fffd. Report an issue: GitHub.