{"record":{"id":"c3b9916999debc84","repo":"nautechsystems/nautilus_trader","slug":"failed-e-c3b991","errorCode":null,"errorMessage":"{FAILED}: {e}","messagePattern":"\\{FAILED\\}: \\{e\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/orders/limit.rs","lineNumber":213,"sourceCode":"            expire_time,\n            post_only,\n            reduce_only,\n            quote_quantity,\n            display_qty,\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 Deref for LimitOrder {\n    type Target = OrderCore;\n\n    fn deref(&self) -> &Self::Target {\n        &self.core\n    }\n}\n\nimpl DerefMut for LimitOrder {\n    fn deref_mut(&mut self) -> &mut Self::Target {\n        &mut self.core\n    }\n}\n\nimpl PartialEq for LimitOrder {","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/orders/limit.rs#L195-L231","documentation":"LimitOrder::new panics with `Condition failed: {e}` when LimitOrder::new_checked returns an OrderError; the convenience `new` constructor unwraps via unwrap_or_else(|e| panic!(...)). Validations run before constructing the order: check_positive_quantity, check_display_qty, check_time_in_force, and OrderInitialized::new_checked invariants. The `FAILED` constant is `\"Condition failed\"` from crates/core/src/correctness.rs.","triggerScenarios":"Calling LimitOrder::new (crates/model/src/orders/limit.rs:159) with: zero or otherwise invalid Quantity, display_qty greater than quantity, TimeInForce::Gtd with None/zero expire_time, or an OrderInitialized invariant violation such as OrderSide::NoOrderSide or invalid contingency/linked_order_ids combination.","commonSituations":"Building limit orders from user/strategy config where quantity defaulted to zero; setting display_qty (iceberg) larger than total quantity; GTD orders without expire_time after a config refactor; converting an external side enum that maps to NoOrderSide.","solutions":["Read the OrderError message in the panic text — it names the failed check precisely.","Use LimitOrder::new_checked instead of new and handle the Result so bad input doesn't panic.","Fix the inputs: positive quantity, display_qty <= quantity, expire_time set for GTD, valid OrderSide.","Validate config-derived values before calling the constructor."],"exampleFix":"// before\nlet order = LimitOrder::new(..., Quantity::from(0), ...); // panics\n// after\nlet order = LimitOrder::new_checked(..., Quantity::from(0), ...)\n    .inspect_err(|e| log::error!(\"invalid limit order: {e}\"))\n    .ok();","handlingStrategy":"validation","validationCode":"fn valid_limit_args(qty: Quantity, display_qty: Option<Quantity>, tif: TimeInForce, expire_time: Option<UnixNanos>) -> Result<(), String> {\n    if qty.raw == 0 { return Err(\"quantity must be positive\".into()); }\n    if let Some(dq) = display_qty { if dq > qty { return Err(\"display_qty exceeds quantity\".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":["Prefer the *_new_checked constructors at boundaries where inputs may be invalid","Never pass GTD without expire_time","Clamp display_qty to quantity","Add unit tests covering invalid quantity/display_qty/TIF combos"],"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"}