{"record":{"id":"b43a70476e54e4bf","repo":"nautechsystems/nautilus_trader","slug":"limit-offset-not-set","errorCode":null,"errorMessage":"Limit offset not set","messagePattern":"Limit offset not set","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/orders/builder.rs","lineNumber":236,"sourceCode":"\n    // ----------- TriggerType ----------\n    pub fn trigger_type(&mut self, trigger_type: TriggerType) -> &mut Self {\n        self.trigger_type = Some(trigger_type);\n        self\n    }\n\n    fn get_trigger_type(&self) -> TriggerType {\n        self.trigger_type.unwrap_or(TriggerType::Default)\n    }\n\n    // ----------- LimitOffset ----------\n    pub fn limit_offset(&mut self, limit_offset: Decimal) -> &mut Self {\n        self.limit_offset = Some(limit_offset);\n        self\n    }\n\n    fn get_limit_offset(&self) -> Decimal {\n        self.limit_offset.expect(\"Limit offset not set\")\n    }\n\n    // ----------- TrailingOffset ----------\n    pub fn trailing_offset(&mut self, trailing_offset: Decimal) -> &mut Self {\n        self.trailing_offset = Some(trailing_offset);\n        self\n    }\n\n    fn get_trailing_offset(&self) -> Decimal {\n        self.trailing_offset.expect(\"Trailing offset not set\")\n    }\n\n    // ----------- TrailingOffsetType ----------\n    pub fn trailing_offset_type(&mut self, trailing_offset_type: TrailingOffsetType) -> &mut Self {\n        self.trailing_offset_type = Some(trailing_offset_type);\n        self\n    }\n","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/orders/builder.rs#L218-L254","documentation":"OrderTestBuilder::get_limit_offset unwraps Option<Decimal> set via .limit_offset(...). build() for trailing order types that require a limit offset panics with 'Limit offset not set' when it was never provided.","triggerScenarios":"Building a TrailingStopLimit (or other offset-requiring order) via OrderTestBuilder without chaining .limit_offset(Decimal) before build().","commonSituations":"Testing trailing stop-limit orders while setting only the trailing offset and forgetting that the limit offset is a separate required field.","solutions":["Add .limit_offset(Decimal::from(...)) to the builder chain before build().","Set both limit_offset and trailing_offset together for trailing stop-limit orders.","Use a trailing-order fixture that supplies both offsets."],"exampleFix":"// before\nlet order = OrderTestBuilder::new(OrderType::TrailingStopLimit)\n    .trailing_offset(Decimal::from(100))\n    .build();\n// after\nlet order = OrderTestBuilder::new(OrderType::TrailingStopLimit)\n    .trailing_offset(Decimal::from(100))\n    .limit_offset(Decimal::from(50))\n    .build();","handlingStrategy":"validation","validationCode":"if matches!(order_type, OrderType::TrailingStopLimit) {\n    assert!(limit_offset.is_some(), \"limit_offset required for TrailingStopLimit\");\n}\nbuilder.limit_offset(limit_offset.unwrap()).build();","typeGuard":null,"tryCatchPattern":"// assert before build\nassert!(limit_offset.is_some());","preventionTips":["Set both .limit_offset(...) and .trailing_offset(...) together for TrailingStopLimit.","Document required fields for trailing order builders in test helpers.","Review trailing-order test setup when copying from stop-order templates."],"tags":["rust","panic","builder","missing-field","testing"],"backgroundTag":"missing-required-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"}