nautechsystems/nautilus_trader · error
invalid fee amount=
Error message
invalid fee amount='{amount}': {e} What it means
After the taker_fee × notional product succeeds, `resolve_commission` converts the fee amount into a `Money` via `Money::from_decimal(amount, currency)`. This error is wrapped when that conversion fails — most commonly the amount's decimal precision exceeds the quote currency's precision (default USDT), or the value is otherwise invalid (negative/zero-scale issues).
Solutions
- Pass the correct `quote_currency` for the symbol so the right precision is used.
- Round the computed fee amount to the currency's precision before `Money::from_decimal`.
- Verify the fee rate's decimal places; truncate excess precision at parse time.
- Reconcile the actual fee via REST user-trades if the computed value keeps failing.
Example fix
// before
Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid fee amount='{amount}': {e}"))
// after
let amount = amount.rescale(currency.precision);
Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid fee amount='{amount}': {e}")) Defensive patterns
Strategy: validation
Validate before calling
// Rust: rescale computed fee to currency precision before conversion let amount = amount.rescale(currency.precision as u32); debug_assert!(amount.scale() <= currency.precision as u32);
Prevention
- Always pass the correct quote_currency so precision matches the symbol
- Truncate fee amounts to currency precision before Money conversion
- Reconcile fees against REST user-trades to catch precision drift
When it happens
Trigger: Trade-type futures order update with `taker_fee` where fee × notional yields more fractional digits than the quote currency (USDT unless `quote_currency` provided) allows, during `parse_futures_order_update_to_fill`.
Common situations: High-precision fee rates (e.g. 0.0004) multiplied by large quantities producing amounts with more decimals than USDT's precision; a non-USDT quote asset not passed as `quote_currency` so precision defaults mismatch.
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
- invalid commission=
- invalid commission=
- invalid fee amount for taker_fee=
- invalid fee notional for last_qty=
- invalid precision
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/881581741dbcd531.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/binance/src/futures/websocket/streams/parse_exec.rs:197
Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid commission='{raw_commission}': {e}"))
} else if let Some(fee) = taker_fee {
let currency = quote_currency.unwrap_or_else(Currency::USDT);
let notional = last_qty
.as_decimal()
.checked_mul(last_px.as_decimal())
.ok_or_else(|| {
anyhow::anyhow!(
"invalid fee notional for last_qty='{last_qty}' and last_px='{last_px}': multiplication overflow",
)
})?;
let amount = fee.checked_mul(notional).ok_or_else(|| {
anyhow::anyhow!(
"invalid fee amount for taker_fee='{fee}' and notional='{notional}': multiplication overflow"
)
})?;
Money::from_decimal(amount, currency)
.map_err(|e| anyhow::anyhow!("invalid fee amount='{amount}': {e}"))
} else {
Ok(Money::zero(Currency::USDT()))
}
}
/// Converts a Binance Futures order update (Trade type) to a Nautilus fill report.
///
/// # Errors
///
/// Returns an error if report construction fails.
#[expect(clippy::too_many_arguments)]
pub fn parse_futures_order_update_to_fill(
msg: &BinanceFuturesOrderUpdateMsg,
account_id: AccountId,
instrument_id: InstrumentId,
price_precision: u8,
size_precision: u8,
taker_fee: Option<Decimal>,View on GitHub (pinned to 18893faf8b)