{"record":{"id":"e1b4f5b56f1ed232","repo":"nautechsystems/nautilus_trader","slug":"slippage-bps-parameter-value-exceeds-the-u32-ran","errorCode":null,"errorMessage":"slippage_bps parameter {value} exceeds the u32 range","messagePattern":"slippage_bps parameter (.+?) exceeds the u32 range","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1218,"sourceCode":"                quote_token.address\n            );\n        }\n\n        let amount_in = quantity_to_raw_amount(order.quantity(), base_token.decimals)?;\n        if amount_in > U256::from(self.transaction_limits.max_order_amount) {\n            anyhow::bail!(\n                \"Order amount {amount_in} exceeds the configured `max_order_amount` {}\",\n                self.transaction_limits.max_order_amount\n            );\n        }\n\n        let slippage_bps = match cmd\n            .params\n            .as_ref()\n            .and_then(|params| params.get_u64(\"slippage_bps\"))\n        {\n            Some(value) => u32::try_from(value).map_err(|_| {\n                anyhow::anyhow!(\"slippage_bps parameter {value} exceeds the u32 range\")\n            })?,\n            None => self.transaction_limits.slippage_bps,\n        };\n\n        if slippage_bps > self.transaction_limits.max_slippage_bps {\n            anyhow::bail!(\n                \"Slippage {slippage_bps} bps exceeds the configured `max_slippage_bps` {}\",\n                self.transaction_limits.max_slippage_bps\n            );\n        }\n\n        let profiler = self\n            .core\n            .cache()\n            .pool_profiler(&instrument_id)\n            .cloned()\n            .ok_or_else(|| {\n                anyhow::anyhow!(","sourceCodeStart":1200,"sourceCodeEnd":1236,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/execution/client.rs#L1200-L1236","documentation":"The SubmitOrder command's params carried a 'slippage_bps' key read as u64, and its value did not fit in u32 (max 4,294,967,295). The per-order override is converted with u32::try_from before being compared against max_slippage_bps, so oversized values are rejected before quoting. In practice the value is a unit mistake rather than a deliberate 42-million-bps slippage request.","triggerScenarios":"submit_order with params like {'slippage_bps': 50_000_000_000} — e.g. slippage passed in wei-style raw units, in hundredths of a bip, or a percentage multiplied by the wrong scale.","commonSituations":"Strategy code computing slippage from a Decimal price and forgetting to cast through a bounded integer; passing 1/1e9-style fractions scaled into a u64; config templates using different bps conventions between teams.","solutions":["Send slippage in basis points as a small integer: 50 = 0.50%, 200 = 2%","Ensure the value fits u32 and is at or below the configured transaction_limits.max_slippage_bps (which itself must be < 10000)","If you did not intend an override, omit 'slippage_bps' entirely and let the default slippage_bps limit apply"],"exampleFix":"# before\norder = self.order_factory.market(\n    instrument_id,\n    order_side=OrderSide.SELL,\n    quantity=base_qty,\n    params={'slippage_bps': 5_000_000_000},  # exceeds u32\n)\n\n# after: 0.50% slippage in basis points\norder = self.order_factory.market(\n    instrument_id,\n    order_side=OrderSide.SELL,\n    quantity=base_qty,\n    params={'slippage_bps': 50},\n)","handlingStrategy":"validation","validationCode":"def sanitized_slippage_bps(params: dict | None, max_allowed: int) -> int | None:\n    \"\"\"Return a safe per-order slippage override, or None to use the default.\"\"\"\n    if not params or 'slippage_bps' not in params:\n        return None\n    value = params['slippage_bps']\n    assert isinstance(value, int) and 0 <= value <= 0xFFFFFFFF, 'slippage_bps must fit u32'\n    assert value <= max_allowed, f'slippage_bps above max_slippage_bps={max_allowed}'\n    return value","typeGuard":"def valid_slippage_param(params: dict | None) -> bool:\n    v = (params or {}).get('slippage_bps')\n    return v is None or (isinstance(v, int) and not isinstance(v, bool) and 0 <= v <= 0xFFFFFFFF)","tryCatchPattern":null,"preventionTips":["Express slippage as small bps integers (50 = 0.50%); never pass raw scaled fractions","Centralize order-params construction in one helper that clamps slippage to the configured max_slippage_bps"],"tags":["blockchain","slippage","order-params","range-error","validation"],"backgroundTag":"parameter-validation","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}