nautechsystems/nautilus_trader · error
BUY quote amount {amount_in} exceeds the configured `quote_s
Error message
BUY quote amount {amount_in} exceeds the configured `quote_spend_limits` maximum {} for {token_in} -> {token_out} What it means
For BUY orders the quote amount spent (amount_in, in the quote token) is checked against a per-pair ceiling in `quote_spend_limits`; exceeding ceiling.max_amount aborts the swap as a spend guard. This limits how much quote token a single BUY swap may consume.
Source
Thrown at crates/adapters/blockchain/src/execution/client.rs:1705
}
(base_amount, exact_output_amount("e, zero_for_one)?)
}
OrderSide::Buy => {
let quote = profiler
.swap_exact_out(base_amount, zero_for_one, None)
.map_err(|e| anyhow::anyhow!("Swap quote failed for {instrument_id}: {e}"))?;
let amount_in = quote.get_input_amount();
if amount_in.is_zero() {
anyhow::bail!("Local quote for {instrument_id} produced a zero quote input");
}
let ceiling = quote_spend_ceiling.ok_or_else(|| {
anyhow::anyhow!(
"No `quote_spend_limits` entry for BUY token pair {token_in} -> {token_out}"
)
})?;
if amount_in > ceiling.max_amount {
anyhow::bail!(
"BUY quote amount {amount_in} exceeds the configured `quote_spend_limits` maximum {} for {token_in} -> {token_out}",
ceiling.max_amount
);
}
(amount_in, base_amount)
}
};
let min_amount_out = derive_min_amount_out(quoted_amount_out, slippage_bps)?;
self.ensure_transaction_ready(TransactionPurpose::Swap)?;
if self.signer.is_none() {
anyhow::bail!("Signer not initialized; connect the client first");
}
let pool_address = pool.address;
let factory = self.uniswap_v3_factory()?;
anyhow::ensure!(View on GitHub (pinned to 18893faf8b)
Solutions
- Raise the `max_amount` for this token pair in `quote_spend_limits` if the spend is intended.
- Reduce the order quantity so the quoted spend fits under the ceiling.
- Split the order into smaller buys, or add a price/sanity check before submitting so orders are not sent when spend would exceed the limit.
Example fix
// before quote_spend_limits[(usdc, weth)].max_amount = 1_000; // too low for order size client.submit_order(cmd, &order)?; // after quote_spend_limits[(usdc, weth)].max_amount = 25_000; // matches intended size client.submit_order(cmd, &order)?;
Defensive patterns
Strategy: validation
Validate before calling
// Rust
if order.order_side() == OrderSide::Buy {
if let Some(ceiling) = transaction_limits.quote_spend_limits.get(&(token_in, token_out)) {
if estimated_spend > ceiling.max_amount {
return Err(anyhow::anyhow!("estimated spend exceeds quote_spend_limits"));
}
}
} Prevention
- Configure quote_spend_limits to match realistic position sizes per pair.
- Re-estimate spend at submission time and split orders exceeding ceilings.
- Add a max-price sanity check so price spikes don't push spend over limits.
When it happens
Trigger: submit_order (BUY side) where the locally quoted amount_in exceeds quote_spend_limits[(token_in, token_out)].max_amount — i.e. the pool price/size makes the swap cost more quote token than the configured ceiling.
Common situations: Large BUY orders on pools with poor pricing so the required spend balloons past the ceiling; quote_spend_limits left at conservative defaults while the strategy sizes positions larger; a price spike between signal and execution inflating the quoted spend.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- No quote spend ceiling for BUY token pair {} -> {}
- BUY quote amount {} exceeds the configured quote-spend maxim
- Token pair {token_in} -> {token_out} is not in the `allowed_
- Order amount {base_amount} exceeds the configured `max_order
- Slippage {slippage_bps} bps exceeds the configured `max_slip
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/9acbc6b8c2ad7255.
Report an issue: GitHub.