{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1613,"sourceCode":"                \"Token pair {token_in} -> {token_out} is not in the `allowed_token_pairs` allowlist\"\n            );\n        }\n\n        let base_amount = quantity_to_raw_amount(order.quantity(), base_token.decimals)?;\n        if base_amount > U256::from(self.transaction_limits.max_order_amount) {\n            anyhow::bail!(\n                \"Order amount {base_amount} 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 quote_spend_ceiling = if order.order_side() == OrderSide::Buy {\n            let ceiling = self\n                .transaction_limits\n                .quote_spend_limits\n                .get(&(token_in, token_out))\n                .ok_or_else(|| {\n                    anyhow::anyhow!(","sourceCodeStart":1595,"sourceCodeEnd":1631,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1595-L1631","documentation":"The slippage_bps custom parameter supplied with the order command cannot be represented in u32 (negative or above 2^32-1); the bounded conversion into the swap-router's slippage bound fails before the transaction is built.","triggerScenarios":"`submit_order()` -> `prepare_swap()` with order params containing `slippage_bps` larger than 4,294,967,295 (e.g. sending raw wei-style or unconverted units).","commonSituations":"Passing slippage as a raw integer in a different unit (e.g. 1e18-scaled); client sends slippage in a string/big-number format; copy-pasted value from another adapter expecting different units.","solutions":["Send slippage_bps as a value within u32 range (basis points, e.g. 50 = 0.5%)","Convert the caller's slippage representation to basis points before submitting the order","Omit the param to fall back to the configured `transaction_limits.slippage_bps`"],"exampleFix":"// before\nparams: {\"slippage_bps\": 500000000000000000000}\n// after\nparams: {\"slippage_bps\": 50} // 0.5%","handlingStrategy":"validation","validationCode":"let slippage: u64 = params.get_u64(\"slippage_bps\")?;\nif slippage > u32::MAX as u64 {\n    return Err(\"slippage_bps must be in basis points (u32 range)\".into());\n}","typeGuard":"fn valid_slippage(v: u64) -> Option<u32> {\n    u32::try_from(v).ok()\n}","tryCatchPattern":"match client.submit_order(order).await {\n    Err(e) if e.to_string().contains(\"exceeds the u32 range\") => {\n        order.params.remove(\"slippage_bps\"); // fall back to configured default\n        client.submit_order(order).await\n    }\n    r => r,\n}","preventionTips":["Always express slippage in basis points (e.g. 50 = 0.5%)","Clamp client-supplied params before submission","Omit slippage_bps to use the configured transaction_limits default"],"tags":["parameters","slippage","overflow","validation"],"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-23T08:17:48.524Z"}