nautechsystems/nautilus_trader · error · anyhow::Error

Conditional order missing trigger price

Error message

Conditional order missing trigger price

What it means

validate_conditional_order_params checks that every field Hyperliquid requires for a trigger (TP/SL) order is present. The first check rejects a None trigger_px, since a conditional order on Hyperliquid is meaningless without the price at which it activates. It is a guard so malformed trigger requests never reach the exchange.

Source

Thrown at crates/adapters/hyperliquid/src/common/parse.rs:890

    if let Some(callback) = callback_price {
        format!("Trailing stop: {offset_desc} offset, callback at {callback}")
    } else {
        format!("Trailing stop: {offset_desc} offset")
    }
}

/// Validates conditional order parameters from WebSocket data.
///
/// # Returns
///
/// `Ok(())` if parameters are valid, `Err` with description otherwise.
pub fn validate_conditional_order_params(
    trigger_px: Option<&str>,
    tpsl: Option<&HyperliquidTpSl>,
    is_market: Option<bool>,
) -> anyhow::Result<()> {
    if trigger_px.is_none() {
        anyhow::bail!("Conditional order missing trigger price");
    }

    if tpsl.is_none() {
        anyhow::bail!("Conditional order missing tpsl indicator");
    }

    // No need to validate tpsl value - the enum type guarantees it's either Tp or Sl

    if is_market.is_none() {
        anyhow::bail!("Conditional order missing is_market flag");
    }

    Ok(())
}

/// Parses trigger price from string to Decimal.
///
/// # Returns

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Provide the trigger price string (e.g. "50000.0") when constructing the conditional/TPSL order params.
  2. Read trigger_px from user input/config explicitly and fail early with a clearer message in your own layer.
  3. If the order should not be conditional, use a plain Market/Limit order path instead of the TPSL path.

Example fix

// before
validate_conditional_order_params(None, Some(&tpsl), Some(true))?;
// after
validate_conditional_order_params(Some("50000.0"), Some(&tpsl), Some(true))?;
Defensive patterns

Strategy: validation

Validate before calling

let trigger_px = params.get("trigger_px").filter(|s| !s.is_empty())
    .ok_or("TPSL order requires trigger_px")?;
validate_conditional_order_params(Some(trigger_px), tpsl, is_market)?;

Prevention

When it happens

Trigger: Calling validate_conditional_order_params with trigger_px: None — typically when building a TP/SL (take-profit/stop-loss) request from parsed string params where the trigger price key was absent or empty.

Common situations: Constructing bracket/TPSL orders from user config where the trigger price field is omitted; parsing venue responses into conditional params and dropping the trigger_px on a code path.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/722264674c873d00. Report an issue: GitHub.