nautechsystems/nautilus_trader · error

{FAILED}: {e}

Error message

{FAILED}: {e}

What it means

LimitIfTouchedOrder::new panics with `Condition failed: {e}` when LimitIfTouchedOrder::new_checked returns an OrderError; the `new` wrapper converts the Err to a panic. Checks include check_positive_quantity, check_display_qty, check_time_in_force and the OrderInitialized::new_checked invariants. `FAILED` is `"Condition failed"` from crates/core/src/correctness.rs.

Source

Thrown at crates/model/src/orders/limit_if_touched.rs:245

            expire_time,
            post_only,
            reduce_only,
            quote_quantity,
            display_qty,
            emulation_trigger,
            trigger_instrument_id,
            contingency_type,
            order_list_id,
            linked_order_ids,
            parent_order_id,
            exec_algorithm_id,
            exec_algorithm_params,
            exec_spawn_id,
            tags,
            init_id,
            ts_init,
        )
        .unwrap_or_else(|e| panic!("{FAILED}: {e}"))
    }
}

impl PartialEq for LimitIfTouchedOrder {
    fn eq(&self, other: &Self) -> bool {
        self.client_order_id == other.client_order_id
    }
}

impl Deref for LimitIfTouchedOrder {
    type Target = OrderCore;

    fn deref(&self) -> &Self::Target {
        &self.core
    }
}

impl DerefMut for LimitIfTouchedOrder {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Inspect the `{e}` OrderError message for the specific failed check.
  2. Switch to LimitIfTouchedOrder::new_checked and handle the Result.
  3. Correct inputs: positive quantity, display_qty <= quantity, expire_time for GTD, valid side.
  4. Validate values from config/IPC before constructing the order.

Example fix

// before
let order = LimitIfTouchedOrder::new(..., Some(display_qty_gt_total), ...); // panics
// after
let order = LimitIfTouchedOrder::new_checked(..., Some(display_qty.min(quantity)), ...)?;
Defensive patterns

Strategy: validation

Validate before calling

fn valid_lit_args(qty: Quantity, display_qty: Option<Quantity>, tif: TimeInForce, expire_time: Option<UnixNanos>) -> Result<(), String> {
    if qty.raw == 0 { return Err("quantity must be positive".into()); }
    if let Some(dq) = display_qty { if dq > qty { return Err("display_qty exceeds quantity".into()); } }
    if tif == TimeInForce::Gtd && expire_time.map_or(true, |t| t.as_u64() == 0) { return Err("GTD requires expire_time".into()); }
    Ok(())
}

Type guard

if qty.is_zero() || side == OrderSide::NoOrderSide { return None; }

Prevention

When it happens

Trigger: Calling LimitIfTouchedOrder::new (crates/model/src/orders/limit_if_touched.rs) with a non-positive quantity, display_qty exceeding quantity, GTD without a valid expire_time, or an invalid init-event invariant (e.g. NoOrderSide, invalid contingency type combination).

Common situations: Strategy configs that leave quantity at a zero default; iceberg display_qty above total quantity; GTD orders created after dropping an expire_time field; programmatically derived sides defaulting to NoOrderSide.

Related errors


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