nautechsystems/nautilus_trader · error

`slippage_bps` exceeds `max_slippage_bps

Error message

`slippage_bps` {slippage_bps} exceeds `max_slippage_bps` {max_slippage_bps}

What it means

slippage_bps (the intended slippage tolerance) must not exceed max_slippage_bps (the configured hard ceiling). The library throws this when the operator's desired slippage is looser than the maximum permitted, which would violate the risk policy invariant slippage_bps <= max_slippage_bps.

Solutions

  1. Lower config.slippage_bps to at most max_slippage_bps
  2. Raise config.max_slippage_bps if the higher tolerance is intentional (and still < BPS_DENOMINATOR, i.e. < 10000)
  3. Audit both values against the trading risk policy

Example fix

// before
slippage_bps = 500
max_slippage_bps = 200
// after
slippage_bps = 150
max_slippage_bps = 200
Defensive patterns

Strategy: validation

Validate before calling

if cfg.slippage_bps > cfg.max_slippage_bps {
    return Err(format!("slippage_bps {} exceeds max_slippage_bps {}", cfg.slippage_bps, cfg.max_slippage_bps));
}

Prevention

When it happens

Trigger: Calling new/transaction_limits with config where slippage_bps > max_slippage_bps, e.g. slippage_bps = 500 and max_slippage_bps = 200.

Common situations: Raising tolerance after editing only one of the two fields; copying values from another environment where the ceiling was higher; misunderstanding which field is the cap.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at crates/adapters/blockchain/src/execution/client.rs:339

            })?;
            let ceiling = QuoteSpendCeiling {
                spend_token,
                spend_token_decimals: limit.spend_token_decimals,
                max_amount,
            };

            if parsed_quote_spend_limits
                .insert((token_in, token_out), ceiling)
                .is_some()
            {
                anyhow::bail!(
                    "Duplicate quote spend limit for token pair {token_in} -> {token_out}"
                );
            }
        }

        if slippage_bps > max_slippage_bps {
            anyhow::bail!(
                "`slippage_bps` {slippage_bps} exceeds `max_slippage_bps` {max_slippage_bps}"
            );
        }

        if max_slippage_bps >= BPS_DENOMINATOR {
            anyhow::bail!("`max_slippage_bps` {max_slippage_bps} must be below {BPS_DENOMINATOR}");
        }

        if !(1..=4_095).contains(&max_quote_age_blocks) {
            anyhow::bail!("`max_quote_age_blocks` must be in 1..=4095");
        }

        Ok(TransactionLimits {
            allowed_token_pairs: parsed_pairs,
            quote_spend_limits: parsed_quote_spend_limits,
            slippage_bps,
            max_slippage_bps,
            max_order_amount,

View on GitHub (pinned to 18893faf8b)