{"record":{"id":"bd44b3de496ef208","repo":"nautechsystems/nautilus_trader","slug":"missing-trigger-price-type-for-derive-trigger-orde","errorCode":null,"errorMessage":"missing trigger price type for Derive trigger order; Derive trigger orders support only MarkPrice","messagePattern":"missing trigger price type for Derive trigger order; Derive trigger orders support only MarkPrice","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/common/parse.rs","lineNumber":175,"sourceCode":"\n/// Maps Nautilus trigger price source to Derive.\n///\n/// # Errors\n///\n/// Returns an error unless the trigger source maps to mark price, which is the\n/// only source Derive currently accepts for trigger orders.\npub fn trigger_price_type_to_derive(\n    trigger_type: Option<TriggerType>,\n) -> anyhow::Result<DeriveTriggerPriceType> {\n    match trigger_type {\n        Some(TriggerType::Default | TriggerType::MarkPrice) => Ok(DeriveTriggerPriceType::Mark),\n        Some(TriggerType::IndexPrice) => anyhow::bail!(\n            \"unsupported trigger price type for Derive: IndexPrice; Derive currently accepts only MarkPrice for trigger orders\"\n        ),\n        Some(other) => anyhow::bail!(\n            \"unsupported trigger price type for Derive: {other:?}; Derive trigger orders support only MarkPrice\"\n        ),\n        None => anyhow::bail!(\n            \"missing trigger price type for Derive trigger order; Derive trigger orders support only MarkPrice\"\n        ),\n    }\n}\n\n/// Maps a Nautilus time-in-force flag to the Derive TIF.\n///\n/// # Errors\n///\n/// Returns an error for time-in-force flags Derive does not accept.\npub fn time_in_force_to_derive(\n    tif: TimeInForce,\n    post_only: bool,\n) -> anyhow::Result<DeriveTimeInForce> {\n    match tif {\n        TimeInForce::Gtc if post_only => Ok(DeriveTimeInForce::PostOnly),\n        TimeInForce::Ioc | TimeInForce::Fok if post_only => anyhow::bail!(\n            \"post-only Derive orders only support GTC time in force; received {tif:?}\"","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/common/parse.rs#L157-L193","documentation":"Derive trigger orders require an explicit trigger price source, and it must be Mark price. When `trigger_price_type_to_derive` is called with `trigger_type: None`, there is no source to map, so it fails with this message rather than silently defaulting.","triggerScenarios":"Creating Derive trigger fields (`DeriveTriggerFields`) or validating support for a trigger order whose Nautilus definition leaves `trigger_type` unset (None) — e.g. an order built without specifying its trigger source.","commonSituations":"Strategies that construct conditional orders without setting trigger type because another venue tolerated a default; Nautilus builder defaults that leave the trigger type as None.","solutions":["Set `trigger_type` explicitly to `TriggerType::MarkPrice` (or `Default`) when constructing the trigger order","Enforce trigger-type assignment in order-construction helpers before dispatching to Derive","Pre-validate with `validate_trigger_order_support` to surface the missing field early"],"exampleFix":"// before\nlet order = order_builder.stop_market(...).build(); // trigger_type None\n// after\nlet order = order_builder.stop_market(...).trigger(TriggerType::MarkPrice).build();","handlingStrategy":"validation","validationCode":"fn has_trigger_type(t: Option<TriggerType>) -> bool { t.is_some() }","typeGuard":"fn trigger_type_set(t: Option<TriggerType>) -> bool { t.is_some() }","tryCatchPattern":"match trigger_price_type_to_derive(order.trigger_type()) {\n    Ok(pt) => { /* build payload */ }\n    Err(e) => tracing::warn!(%e, \"trigger order missing required trigger type\"),\n}","preventionTips":["Always set trigger type explicitly when building conditional orders","Enforce trigger-type assignment in order-construction helpers","Run validate_trigger_order_support before dispatch to Derive"],"tags":["rust","derive","orders","triggers","validation"],"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"}