nautechsystems/nautilus_trader · error · anyhow::Error

Failed to build edit order params: {e}

Error message

Failed to build edit order params: {e}

What it means

Raised when the Kraken Futures edit-order params builder's build() fails after assembling amended fields (price, quantity, trigger/stop price). The requested modification forms an invalid parameter set for the venue.

Source

Thrown at crates/adapters/kraken/src/http/futures/client.rs:2682

        if let Some(ref id) = cli_ord_id {
            builder.cli_ord_id(id.clone());
        }

        if let Some(qty) = quantity {
            builder.size(qty.to_string());
        }

        if let Some(p) = price {
            builder.limit_price(p.to_string());
        }

        if let Some(tp) = trigger_price {
            builder.stop_price(tp.to_string());
        }

        builder
            .build()
            .map_err(|e| anyhow::anyhow!("Failed to build edit order params: {e}"))
    }
}

pub(crate) fn is_futures_submit_rejection(status: &str) -> bool {
    matches!(
        status.parse::<KrakenSendStatus>(),
        Ok(KrakenSendStatus::InsufficientAvailableFunds
            | KrakenSendStatus::InvalidOrderType
            | KrakenSendStatus::InvalidSize
            | KrakenSendStatus::WouldCauseLiquidation
            | KrakenSendStatus::PostWouldExecute
            | KrakenSendStatus::ReduceOnlyWouldIncreasePosition)
    )
}

fn is_futures_modify_rejection(status: &str) -> bool {
    status.parse::<KrakenSendStatus>().is_ok_and(|status| {
        status == KrakenSendStatus::NotFound || is_futures_submit_rejection(status.as_ref())

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Read the wrapped error for the specific invalid field.
  2. Ensure amended price/quantity respect the instrument's price_increment and size_step.
  3. Only pass the fields you intend to change; avoid setting stop_price on order types without triggers.
  4. If the order type can't be amended, cancel and resubmit instead.

Example fix

// before
builder.quantity(qty.to_string()).price(px.to_string()).stop_price(tp.to_string()); // stop price on a plain limit order
// after
builder.quantity(qty.to_string()).price(px.to_string()); // only amend supported fields
Defensive patterns

Strategy: validation

Validate before calling

assert!(px % instrument.price_increment == 0, "edit price off tick");
assert!(qty % instrument.size_step == 0, "edit quantity off step");

Try / catch

let params = build_edit_order_params(...).context("preparing Kraken Futures edit params")?;

Prevention

When it happens

Trigger: The edit-order param builder is invoked (via the client's modify/edit order path) and builder.build() rejects the combination — e.g. both price and stop_price updated to invalid values, empty amend with no changeable fields, or malformed Decimal formatting.

Common situations: Modifying an order to a price/quantity that violates instrument precision; trying to amend fields not allowed for that order type; passing a trigger price on a non-trigger order.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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