{"record":{"id":"d336403cac550b57","repo":"nautechsystems/nautilus_trader","slug":"failed-e-d33640","errorCode":null,"errorMessage":"{FAILED}: {e}","messagePattern":"\\{FAILED\\}: \\{e\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/orders/market_to_limit.rs","lineNumber":199,"sourceCode":"            quantity,\n            time_in_force,\n            expire_time,\n            post_only,\n            reduce_only,\n            quote_quantity,\n            display_qty,\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 MarketToLimitOrder {\n    fn eq(&self, other: &Self) -> bool {\n        self.client_order_id == other.client_order_id\n    }\n}\n\nimpl Deref for MarketToLimitOrder {\n    type Target = OrderCore;\n\n    fn deref(&self) -> &Self::Target {\n        &self.core\n    }\n}\n\nimpl DerefMut for MarketToLimitOrder {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/orders/market_to_limit.rs#L181-L217","documentation":"MarketToLimitOrder::new panics with `Condition failed: {e}` when MarketToLimitOrder::new_checked returns an OrderError; `new` converts Err into a panic. Checks include check_positive_quantity, check_display_qty, and OrderInitialized::new_checked invariants. `FAILED` is `\"Condition failed\"` from crates/core/src/correctness.rs.","triggerScenarios":"Calling MarketToLimitOrder::new (crates/model/src/orders/market_to_limit.rs) with a non-positive quantity, display_qty greater than quantity, or an OrderInitialized::new_checked invariant violation (NoOrderSide, invalid contingency/linked-order configuration).","commonSituations":"Iceberg-style display_qty above total quantity; zero quantity from a strategy template; side defaulting through an unvalidated conversion; orders rebuilt from serialized events with invalid metadata.","solutions":["Read the `{e}` OrderError text to identify which check failed.","Use MarketToLimitOrder::new_checked and handle the Result.","Correct inputs: positive quantity, display_qty <= quantity, valid OrderSide.","Sanitize config/deserialized values before construction."],"exampleFix":"// before\nlet order = MarketToLimitOrder::new(..., Quantity::from(0), ...); // panics\n// after\nlet order = MarketToLimitOrder::new_checked(..., Quantity::from(100), ...)?;","handlingStrategy":"validation","validationCode":"fn valid_mtl_args(qty: Quantity, display_qty: Option<Quantity>) -> 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    Ok(())\n}","typeGuard":"if qty.is_zero() || side == OrderSide::NoOrderSide { return None; }","tryCatchPattern":null,"preventionTips":["Cap display_qty at total quantity","Check quantity > 0 before constructing any order","Use new_checked for externally sourced inputs"],"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-14T05:17:10.506Z"}