{"record":{"id":"9516af09cbe26cf0","repo":"nautechsystems/nautilus_trader","slug":"failed-e-9516af","errorCode":null,"errorMessage":"{FAILED}: {e}","messagePattern":"\\{FAILED\\}: \\{e\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/orders/market.rs","lineNumber":188,"sourceCode":"            instrument_id,\n            client_order_id,\n            order_side,\n            quantity,\n            time_in_force,\n            init_id,\n            ts_init,\n            reduce_only,\n            quote_quantity,\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        )\n        .unwrap_or_else(|e| panic!(\"{FAILED}: {e}\"))\n    }\n}\n\nimpl Deref for MarketOrder {\n    type Target = OrderCore;\n\n    fn deref(&self) -> &Self::Target {\n        &self.core\n    }\n}\n\nimpl DerefMut for MarketOrder {\n    fn deref_mut(&mut self) -> &mut Self::Target {\n        &mut self.core\n    }\n}\n\nimpl PartialEq for MarketOrder {","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/orders/market.rs#L170-L206","documentation":"MarketOrder::new panics with `Condition failed: {e}` when MarketOrder::new_checked returns an OrderError; `new` unwraps into a panic. MarketOrder runs check_positive_quantity and the OrderInitialized::new_checked invariants (it has no price/expire-time checks). `FAILED` is `\"Condition failed\"` from crates/core/src/correctness.rs.","triggerScenarios":"Calling MarketOrder::new (crates/model/src/orders/market.rs) with a zero/non-positive Quantity, OrderSide::NoOrderSide, or an OrderInitialized::new_checked violation (invalid contingency/linked_order_ids, already-invalid identifier or metadata combination).","commonSituations":"Market orders built with a quantity defaulted to zero from a strategy template; sides mapped from an unvalidated external enum; reconstruction from serialized events with corrupt/zero quantity.","solutions":["Read the `{e}` OrderError text — for market orders it is almost always the positive-quantity check.","Use MarketOrder::new_checked and handle the Result instead of panicking.","Ensure quantity > 0 and a concrete OrderSide before construction.","Sanitize deserialized order payloads before rebuilding MarketOrder."],"exampleFix":"// before\nlet order = MarketOrder::new(..., OrderSide::NoOrderSide, Quantity::from(0), ...); // panics\n// after\nlet order = MarketOrder::new_checked(..., OrderSide::Buy, Quantity::from(100), ...)?;","handlingStrategy":"validation","validationCode":"fn valid_market_args(side: OrderSide, qty: Quantity) -> Result<(), String> {\n    if qty.raw == 0 { return Err(\"quantity must be positive\".into()); }\n    if side == OrderSide::NoOrderSide { return Err(\"side must be Buy or Sell\".into()); }\n    Ok(())\n}","typeGuard":"if qty.is_zero() || side == OrderSide::NoOrderSide { return None; }","tryCatchPattern":null,"preventionTips":["Check quantity > 0 before any order construction","Map external side enums to OrderSide::Buy/Sell with a validated fallback","Use new_checked at deserialization boundaries"],"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"}