{"record":{"id":"650c0a5ea5d24b76","repo":"nautechsystems/nautilus_trader","slug":"invalid-cumulative-quote-qty-for-cumulative-f","errorCode":null,"errorMessage":"invalid cumulative_quote_qty='{}' for cumulative_filled_qty='{}': division overflow","messagePattern":"invalid cumulative_quote_qty='(.+?)' for cumulative_filled_qty='(.+?)': division overflow","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/websocket/trading/parse.rs","lineNumber":84,"sourceCode":"    let order_status = parse_order_status(msg.order_status, treat_expired_as_canceled);\n    let order_type = parse_spot_order_type(&msg.order_type);\n    let time_in_force = parse_time_in_force(msg.time_in_force);\n\n    let quantity =\n        parse_required_quantity_at_precision(&msg.original_qty, size_precision, \"original_qty\")?;\n    let filled_qty = parse_required_quantity_at_precision(\n        &msg.cumulative_filled_qty,\n        size_precision,\n        \"cumulative_filled_qty\",\n    )?;\n    let price = parse_required_price_at_precision(&msg.price, price_precision, \"price\")?;\n\n    let filled_qty_decimal =\n        parse_required_decimal(&msg.cumulative_filled_qty, \"cumulative_filled_qty\")?;\n    let avg_px = if filled_qty_decimal > Decimal::ZERO {\n        let cum_quote = parse_required_decimal(&msg.cumulative_quote_qty, \"cumulative_quote_qty\")?;\n        let avg_px = cum_quote.checked_div(filled_qty_decimal).ok_or_else(|| {\n            anyhow::anyhow!(\n                \"invalid cumulative_quote_qty='{}' for cumulative_filled_qty='{}': division overflow\",\n                msg.cumulative_quote_qty,\n                msg.cumulative_filled_qty,\n            )\n        })?;\n        Some(Price::from_decimal_dp(avg_px, price_precision)?)\n    } else {\n        None\n    };\n\n    let mut report = OrderStatusReport::new(\n        account_id,\n        instrument_id,\n        Some(client_order_id),\n        venue_order_id,\n        order_side.into(),\n        order_type,\n        time_in_force,","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/websocket/trading/parse.rs#L66-L102","documentation":"While computing the average price of an execution report, `cumulative_quote_qty / cumulative_filled_qty` overflowed the `Decimal` checked-division capacity. `parse_spot_exec_report_to_order_status` only computes `avg_px` when filled quantity is positive, and `checked_div` returning `None` (numeric overflow in fixed-point Decimal) yields this error.","triggerScenarios":"An execution report where `cumulative_quote_qty` is enormous relative to `cumulative_filled_qty` (or a filled qty like a tiny epsilon) so the quotient exceeds Decimal's 128-bit fixed-point range; `checked_div` returns `None`.","commonSituations":"Dust fills with a minuscule `cumulative_filled_qty` and a normal quote amount; Binance sending scientific/mismatched precision strings; extreme price symbols where the quotient blows past the Decimal exponent bounds.","solutions":["Inspect the report's `cumulative_quote_qty` and `cumulative_filled_qty` for extreme values; if it's a dust fill, consider computing avg_px as None for negligible fills.","Verify instrument `price_precision`/`size_precision` are correct; wrong precision amplifies exponent overflow.","Pre-check the ratio magnitude before dividing and fall back to a None/rounded avg price instead of failing the whole report.","Update the adapter if Binance changed quantity/quote precision for the symbol."],"exampleFix":"// before: hard fail on division overflow\nlet avg_px = cum_quote.checked_div(filled_qty_decimal).ok_or_else(|| anyhow!(\"...division overflow\"))?;\n// after: tolerate overflow for dust fills\nlet avg_px = cum_quote.checked_div(filled_qty_decimal).ok_or(None).map(Price::from_decimal_dp).ok();","handlingStrategy":"fallback","validationCode":"fn avg_px_computable(cum_quote: Decimal, filled: Decimal) -> bool {\n    filled > Decimal::ZERO\n        && cum_quote.checked_div(filled).is_some()\n}","typeGuard":null,"tryCatchPattern":"let avg_px = match cum_quote.checked_div(filled_qty_decimal) {\n    Some(px) => Some(Price::from_decimal_dp(px, price_precision)?),\n    None => {\n        log::warn!(\"avg px division overflow; leaving avg_px unset\");\n        None\n    }\n};","preventionTips":["Treat dust fills specially: leave avg price unset when filled qty is negligible.","Verify instrument price/size precision metadata.","Prefer checked arithmetic with graceful degradation in order-status normalization."],"tags":["decimal","overflow","order-execution","binance","rust"],"backgroundTag":"value-out-of-range","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}