{"record":{"id":"f94910a7794a429e","repo":"nautechsystems/nautilus_trader","slug":"stop-limit-order-missing-trigger-price","errorCode":null,"errorMessage":"Stop limit order missing trigger_price","messagePattern":"Stop limit order missing trigger_price","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/execution/mod.rs","lineNumber":1485,"sourceCode":"                        let trigger_price = order.trigger_price().ok_or_else(|| {\n                            anyhow::anyhow!(\"Stop market order missing trigger_price\")\n                        })?;\n                        let cond_expire = order.expire_time().map(nanos_to_secs_i64);\n                        let msg = order_builder.build_stop_market_order(\n                            instrument_id,\n                            client_id_u32,\n                            client_metadata,\n                            order.order_side(),\n                            trigger_price,\n                            order.quantity(),\n                            order.is_reduce_only(),\n                            cond_expire,\n                        )?;\n                        (msg, \"stop_market\")\n                    }\n                    OrderType::StopLimit => {\n                        let trigger_price = order.trigger_price().ok_or_else(|| {\n                            anyhow::anyhow!(\"Stop limit order missing trigger_price\")\n                        })?;\n                        let limit_price = order.price().ok_or_else(|| {\n                            anyhow::anyhow!(\"Stop limit order missing limit price\")\n                        })?;\n                        let cond_expire = order.expire_time().map(nanos_to_secs_i64);\n                        let msg = order_builder.build_stop_limit_order(\n                            instrument_id,\n                            client_id_u32,\n                            client_metadata,\n                            order.order_side(),\n                            trigger_price,\n                            limit_price,\n                            order.quantity(),\n                            order.time_in_force(),\n                            order.is_post_only(),\n                            order.is_reduce_only(),\n                            cond_expire,\n                        )?;","sourceCodeStart":1467,"sourceCodeEnd":1503,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/execution/mod.rs#L1467-L1503","documentation":"dYdX STOP_LIMIT conditional orders need both a trigger_price (activation) and a limit price (execution). The client first checks order.trigger_price(); if None it throws this error. Trigger and limit prices are sent as separate fields in the on-chain message.","triggerScenarios":"Submitting a StopLimit order whose trigger_price was never set (factory call omitted it, or plain Limit order converted to StopLimit).","commonSituations":"order_factory.stop_limit call missing trigger_price; editing an order's type without setting the trigger; restoring orders from persistence where the trigger field was dropped.","solutions":["Pass trigger_price to the stop_limit factory call","Validate both trigger_price and price exist before submit","Verify the order was built with the StopLimit factory method rather than mutated later"],"exampleFix":"// before\nlet order = factory.stop_limit(id, side, qty, price, None); // trigger missing\n// after\nlet order = factory.stop_limit(id, side, qty, price, Some(trigger_price));","handlingStrategy":"validation","validationCode":"if order.order_type() == OrderType::StopLimit {\n    if order.trigger_price().is_none() {\n        return Err(\"StopLimit order requires a trigger_price for dYdX\".into());\n    }\n    if order.price().is_none() {\n        return Err(\"StopLimit order requires a limit price for dYdX\".into());\n    }\n}","typeGuard":"fn stop_limit_complete(order: &OrderAny) -> bool {\n    order.trigger_price().is_some() && order.price().is_some()\n}","tryCatchPattern":"if let Err(e) = client.submit_order(order).await {\n    if e.to_string().contains(\"Stop limit order missing\") {\n        // rebuild the order with both trigger and limit prices\n    }\n}","preventionTips":["Always supply both trigger_price and price to stop_limit factory calls","Centralize order creation in a helper that enforces required fields per type","Add table-driven tests for each order type's required fields"],"tags":["rust","orders","conditional-orders","dydx"],"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-14T00:17:10.932Z"}