{"record":{"id":"12f7d1fbeec64856","repo":"nautechsystems/nautilus_trader","slug":"failed-e-12f7d1","errorCode":null,"errorMessage":"{FAILED}: {e}","messagePattern":"\\{FAILED\\}: \\{e\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/orders/market_if_touched.rs","lineNumber":209,"sourceCode":"            trigger_type,\n            time_in_force,\n            expire_time,\n            reduce_only,\n            quote_quantity,\n            emulation_trigger,\n            trigger_instrument_id,\n            contingency_type,\n            order_list_id,\n            linked_order_ids,\n            parent_order_id,\n            exec_algorithm_id,\n            exec_algorithm_params,\n            exec_spawn_id,\n            tags,\n            init_id,\n            ts_init,\n        )\n        .unwrap_or_else(|e| panic!(\"{FAILED}: {e}\"))\n    }\n}\n\nimpl PartialEq for MarketIfTouchedOrder {\n    fn eq(&self, other: &Self) -> bool {\n        self.client_order_id == other.client_order_id\n    }\n}\n\nimpl Deref for MarketIfTouchedOrder {\n    type Target = OrderCore;\n\n    fn deref(&self) -> &Self::Target {\n        &self.core\n    }\n}\n\nimpl DerefMut for MarketIfTouchedOrder {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/orders/market_if_touched.rs#L191-L227","documentation":"MarketIfTouchedOrder::new panics with `Condition failed: {e}` when MarketIfTouchedOrder::new_checked returns an OrderError; the `new` wrapper converts Err into a panic. Checks include check_positive_quantity, check_time_in_force (GTD requires expire_time) and OrderInitialized::new_checked invariants. `FAILED` is `\"Condition failed\"` from crates/core/src/correctness.rs.","triggerScenarios":"Calling MarketIfTouchedOrder::new (crates/model/src/orders/market_if_touched.rs) with a non-positive quantity, TimeInForce::Gtd with None/zero expire_time, or an invalid init-event invariant such as NoOrderSide.","commonSituations":"GTD MIT orders created without expire_time; zero quantity from a defaulted strategy config; side lost in an enum round-trip; rebuilding orders from cache/serialized events with missing fields.","solutions":["Inspect the OrderError message inside the panic for the exact failed check.","Call MarketIfTouchedOrder::new_checked and handle Result.","Fix inputs: positive quantity, expire_time for GTD, valid side.","Validate strategy-config values before construction."],"exampleFix":"// before\nlet order = MarketIfTouchedOrder::new(..., TimeInForce::Gtd, None, ...); // panics\n// after\nlet order = MarketIfTouchedOrder::new_checked(..., TimeInForce::Gtd, Some(expire_unix_nanos), ...)?;","handlingStrategy":"validation","validationCode":"fn valid_mit_args(qty: Quantity, tif: TimeInForce, expire_time: Option<UnixNanos>) -> Result<(), String> {\n    if qty.raw == 0 { return Err(\"quantity must be positive\".into()); }\n    if tif == TimeInForce::Gtd && expire_time.map_or(true, |t| t.as_u64() == 0) { return Err(\"GTD requires expire_time\".into()); }\n    Ok(())\n}","typeGuard":"if qty.is_zero() || side == OrderSide::NoOrderSide { return None; }","tryCatchPattern":null,"preventionTips":["Always set expire_time for GTD","Verify quantity positivity at config load time","Prefer new_checked at boundaries with untrusted input"],"tags":["rust","orders","panic","constructor","validation"],"backgroundTag":"invalid-constructor-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}