nautechsystems/nautilus_trader · error

Invalid {field} precision {actual}, expected {expected} for

Error message

Invalid {field} precision {actual}, expected {expected} for {}

What it means

Precision guard (check_price_precision) invoked when the matching engine's instrument definition is updated: fields must carry exactly the instrument's declared price precision; a mismatch would break price invariants and triggers dropping incompatible orders.

Source

Thrown at crates/execution/src/matching_engine/mod.rs:1298

                instrument.id(),
                instrument.price_precision(),
                instrument.size_precision()
            );
        }

        self.instrument = instrument;

        if changed {
            self.drop_incompatible_core_orders();
        }

        Ok(())
    }

    fn check_price_precision(&self, actual: u8, field: &str) -> anyhow::Result<()> {
        let expected = self.instrument.price_precision();
        if actual != expected {
            anyhow::bail!(
                "Invalid {field} precision {actual}, expected {expected} for {}",
                self.instrument.id()
            );
        }
        Ok(())
    }

    fn check_size_precision(&self, actual: u8, field: &str) -> anyhow::Result<()> {
        let expected = self.instrument.size_precision();
        if actual != expected {
            anyhow::bail!(
                "Invalid {field} precision {actual}, expected {expected} for {}",
                self.instrument.id()
            );
        }
        Ok(())
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Align the field's precision with the updated instrument precision
  2. Update the instrument definition consistently with the data being processed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/execution/src/matching_engine/mod.rs:1298 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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