nautechsystems/nautilus_trader · error
{currency} commission total exceeds Money bounds
Error message
{currency} commission total exceeds Money bounds What it means
The account accumulates per-currency commission totals using fixed-precision Money arithmetic; if adding a commission would overflow the Money representation, the update is rejected so the existing total is preserved rather than corrupted. The account's commission total for that currency is left unchanged.
Source
Thrown at crates/model/src/accounts/base.rs:216
/// Updates the account commissions with the provided amount.
///
/// # Errors
///
/// Returns an error if the accumulated commission exceeds [`Money`] bounds.
pub fn try_update_commissions(&mut self, commission: Money) -> anyhow::Result<()> {
// TODO: Remove once from_raw enforces canonical precision alignment (v2)
let commission = commission.normalized();
if commission.is_zero() {
return Ok(());
}
let currency = commission.currency;
let total = self
.commissions
.get(¤cy)
.copied()
.map_or(Some(commission), |total| total.checked_add(commission))
.ok_or_else(|| anyhow::anyhow!("{currency} commission total exceeds Money bounds"))?;
self.commissions.insert(currency, total);
Ok(())
}
/// Returns the total commission for the specified currency.
#[must_use]
pub fn commission(&self, currency: &Currency) -> Option<Money> {
self.commissions.get(currency).copied()
}
/// Returns a map of all commissions by currency.
#[must_use]
pub fn commissions(&self) -> AHashMap<Currency, Money> {
self.commissions.clone()
}
/// Checks the event belongs to this account.
///View on GitHub (pinned to 18893faf8b)
Solutions
- Verify commission amounts passed to update_commissions are plausible per-fill values
- Check whether commission rates/notional calculations are correct upstream
- Persist/reset account state if the accumulated total is genuinely at its bound
Defensive patterns
Strategy: try-catch
Validate before calling
from decimal import Decimal
assert 0 < commission.as_decimal() < Decimal('1e18'), 'commission implausibly large' Try / catch
try:
account.update_commissions(commission)
except Exception as e:
log.warning(f"commission update rejected: {e}") # total preserved Prevention
- Sanity-check commission magnitude against notional before applying
- Keep commission rates as fractions, not percentages
- Reset/reconcile long-lived account state periodically
When it happens
Trigger: Calling `update_commissions` (via `try_update_commissions`) with a commission whose checked_add against the existing total for that currency overflows Money's bounds.
Common situations: Extremely large fill quantities/prices producing astronomical commissions, accumulating commissions over a very long-lived account, or a bug feeding gross notional values instead of commission amounts.
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
- WETH balance overflow for included transaction {tx_hash} at
- DurationNanos overflow in from_micros
- {e}
- Estimated gas {estimate} with {gas_buffer_bps} bps buffer ({
- DateTime timestamp out of range for UnixNanos: {nanos}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/d1118d7d0ee1c9ea.
Report an issue: GitHub.