nautechsystems/nautilus_trader · error

FX rollover batch end date was not recorded

Error message

FX rollover batch end date was not recorded

What it means

Thrown when the rollover day's `pending_end_date` was not recorded although the acknowledge phase requires it. The end date is captured when the rollover batch begins; its absence with pending adjustments present means the batch state was assembled incompletely.

Source

Thrown at crates/backtest/src/modules/fx_rollover.rs:681

                .ok_or_else(|| anyhow::anyhow!("no completed FX rollover batch to acknowledge"))?
                .len();
            anyhow::ensure!(
                outcomes.len() == adjustment_count,
                "FX rollover acknowledgement count {}, expected {}",
                outcomes.len(),
                adjustment_count
            );
            let adjustments = day
                .pending_adjustments
                .take()
                .ok_or_else(|| anyhow::anyhow!("no completed FX rollover batch to acknowledge"))?;
            (
                adjustments,
                day.attempt_time
                    .take()
                    .ok_or_else(|| anyhow::anyhow!("FX rollover attempt time was not recorded"))?,
                day.pending_end_date.ok_or_else(|| {
                    anyhow::anyhow!("FX rollover batch end date was not recorded")
                })?,
            )
        };

        let mut failed = Vec::new();
        {
            let mut totals = self.rollover_totals.borrow_mut();
            let mut unapplied_totals = self.unapplied_rollover_totals.borrow_mut();

            for (adjustment, outcome) in adjustments.into_iter().zip(outcomes) {
                match outcome {
                    AccountAdjustmentOutcome::Applied => {
                        let total = totals.entry(adjustment.amount.currency).or_insert(0.0);
                        *total += adjustment.amount.as_f64();
                    }
                    AccountAdjustmentOutcome::Failed(error) => {
                        let kind = AccountAdjustmentFailureKind::from(error);
                        let first_failure = self

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use the module's normal batch-start path so pending_end_date is recorded together with pending_adjustments
  2. Fix snapshot/restore code to include pending_end_date
  3. Verify no external code clears or fails to set pending_end_date
Defensive patterns

Strategy: validation

Validate before calling

debug_assert!(day.pending_adjustments.is_none() || day.pending_end_date.is_some());

Prevention

When it happens

Trigger: `pending_adjustments` is Some but `pending_end_date` is None during `process_rollover`'s acknowledge phase — from partial state restore or code that starts a batch without recording the end date.

Common situations: Hand-built module state in tests; incomplete snapshot deserialization; broken custom rollover scheduling.

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/13ff96aee1a53645. Report an issue: GitHub.