nautechsystems/nautilus_trader · error

fill group is empty

Error message

fill group is empty

What it means

An internal invariant check in `create_orphan_fill_order_report`: the function requires a non-empty slice of `FillReport` references to synthesize an order status report for an orphan fill (a fill that arrived without a matching order). If the fill group is empty, the precondition is violated and it bails rather than fabricate a report.

Source

Thrown at crates/live/src/execution/manager.rs:1268

        }

        log::info!(
            color = LogColor::Blue as u8;
            "Reconciliation complete for {venue}: reconciled={orders_reconciled}, external={external_orders_created}, open={open_orders_initialized}, fills={fills_applied}, positions={positions_created}, skipped={orders_skipped_duplicate}, filtered={orders_skipped_filtered}",
        );

        ReconciliationResult {
            events,
            external_orders,
        }
    }

    fn create_orphan_fill_order_report(
        fills: &[&FillReport],
        instrument: &InstrumentAny,
    ) -> anyhow::Result<OrderStatusReport> {
        let Some(first) = fills.first() else {
            anyhow::bail!("fill group is empty");
        };
        let venue_position_id = first
            .venue_position_id
            .ok_or_else(|| anyhow::anyhow!("venue position ID is missing"))?;

        for fill in fills.iter().skip(1) {
            anyhow::ensure!(
                fill.account_id == first.account_id,
                "account ID differs across fill group"
            );
            anyhow::ensure!(
                fill.instrument_id == first.instrument_id,
                "instrument ID differs across fill group"
            );
            anyhow::ensure!(
                fill.venue_order_id == first.venue_order_id,
                "venue order ID differs across fill group"
            );

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Report the occurrence with logs to the nautilus_trader maintainers — it signals an internal bug in orphan fill handling.
  2. Check your adapter for emitting malformed/empty fill batches that could confuse grouping.
  3. As a mitigation, ensure fills are logged so the orphan fills can be reconciled manually against the venue.
Defensive patterns

Strategy: try-catch

Try / catch

// Not user-fixable; log and report
if let Err(e) = create_orphan_fill_order_report(&fills, &instrument) {
    log::error!("internal orphan-fill failure: {e:#}");
    /* report bug to maintainers with logs */
}

Prevention

When it happens

Trigger: Internal call path groups orphan fills by (order key/venue) and calls this helper per group; an empty group reaching the helper indicates a bug in the grouping logic, not normal user-triggerable input.

Common situations: Encountered only via a live-execution bug or adapter anomaly where fill grouping produced an empty bucket; should never occur through normal API usage.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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