{"record":{"id":"ed60c36ff4791c30","repo":"nautechsystems/nautilus_trader","slug":"e-ed60c3","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"panic","errorClass":"OrderError","httpStatus":null,"severity":"error","filePath":"crates/common/src/factories/order.rs","lineNumber":169,"sourceCode":"        quote_quantity: Option<bool>,\n        exec_algorithm_id: Option<ExecAlgorithmId>,\n        exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,\n        tags: Option<Vec<Ustr>>,\n        client_order_id: Option<ClientOrderId>,\n    ) -> OrderAny {\n        self.try_market(\n            instrument_id,\n            order_side,\n            quantity,\n            time_in_force,\n            reduce_only,\n            quote_quantity,\n            exec_algorithm_id,\n            exec_algorithm_params,\n            tags,\n            client_order_id,\n        )\n        .unwrap_or_else(|e| panic!(\"{e}\"))\n    }\n\n    #[expect(clippy::too_many_arguments)]\n    pub(crate) fn try_market(\n        &mut self,\n        instrument_id: InstrumentId,\n        order_side: OrderSide,\n        quantity: Quantity,\n        time_in_force: Option<TimeInForce>,\n        reduce_only: Option<bool>,\n        quote_quantity: Option<bool>,\n        exec_algorithm_id: Option<ExecAlgorithmId>,\n        exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,\n        tags: Option<Vec<Ustr>>,\n        client_order_id: Option<ClientOrderId>,\n    ) -> anyhow::Result<OrderAny> {\n        let client_order_id = client_order_id.unwrap_or_else(|| self.generate_client_order_id());\n        let exec_spawn_id: Option<ClientOrderId> = if exec_algorithm_id.is_none() {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/common/src/factories/order.rs#L151-L187","documentation":"OrderFactory::market builds a market order via try_market and panics on any underlying validation error, propagating the error text as the panic message. Any condition that makes try_market return Err (e.g. invalid instrument state or price/quantity constraints) surfaces here as a panic.","triggerScenarios":"Calling market() with parameters that fail try_market validation — such as an instrument that doesn't allow market orders, invalid quantity/price precision, or a bad client_order_id — instead of using the fallible try_market API.","commonSituations":"Test helpers building orders with fixtures whose instrument_id doesn't match a registered instrument; migrating code to the panic variant to 'simplify' setup and hitting a validation rule; wrong tick size/precision in instrument definitions.","solutions":["Switch to try_market and handle the returned Result to see the real validation error","Validate the instrument supports MARKET orders and that qty/price precisions are correct","Verify instrument_id matches a registered instrument and client_order_id format","Fix the fixture/config value reported in the propagated error message"],"exampleFix":"// before\nlet order = factory.market(instrument_id, OrderSide::Buy, Quantity::from(0));\n// after\nlet order = factory.try_market(instrument_id, OrderSide::Buy, Quantity::from(1), None)?;","handlingStrategy":"try-catch","validationCode":"// prefer fallible construction\nlet order = factory.try_market(instrument_id, side, qty, None)?;","typeGuard":null,"tryCatchPattern":"// use the Result-returning variant instead of the panicking one\nmatch factory.try_market(instrument_id, side, qty, None) {\n    Ok(order) => { /* use order */ }\n    Err(e) => eprintln!(\"market order rejected: {e}\"),\n}","preventionTips":["Use try_market in production code; reserve market() for tests with known-good fixtures","Validate quantity against instrument size_increment before construction","Confirm instrument_id is registered and supports MARKET orders"],"tags":["rust","order-factory","panic","validation"],"backgroundTag":"invalid-argument-value","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"}