{"record":{"id":"fbd8c0e34acd4b76","repo":"nautechsystems/nautilus_trader","slug":"order-amount-base-amount-exceeds-the-configured","errorCode":null,"errorMessage":"Order amount {base_amount} exceeds the configured `max_order_amount` {}","messagePattern":"Order amount (.+?) exceeds the configured `max_order_amount` (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1601,"sourceCode":"            &quote_token.name,\n            CurrencyType::Crypto,\n        )?;\n        let (token_in, token_out) =\n            swap_token_pair(order.order_side(), base_token.address, quote_token.address)?;\n\n        if !self\n            .transaction_limits\n            .allowed_token_pairs\n            .contains(&(token_in, token_out))\n        {\n            anyhow::bail!(\n                \"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!(","sourceCodeStart":1583,"sourceCodeEnd":1619,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1583-L1619","documentation":"The raw base-token amount of the order is converted with quantity_to_raw_amount and compared against transaction_limits.max_order_amount; orders whose base amount exceeds this configured cap are rejected as a risk guard. The comparison is done in raw integer units (U256) at the token's native precision.","triggerScenarios":"submit_order where quantity_to_raw_amount(order.quantity(), base_token.decimals) > U256::from(transaction_limits.max_order_amount) — i.e. the order size in base token units exceeds the configured maximum.","commonSituations":"Strategy sized for a CEX (large position sizes) running against a DEX adapter with conservative defaults; max_order_amount left at a low default; decimal mismatch making the raw amount appear larger than intended.","solutions":["Raise `max_order_amount` in the transaction_limits configuration if the size is intended.","Reduce the strategy's order/position size below the configured cap.","Verify token decimals are configured correctly so the raw-amount comparison is not inflated."],"exampleFix":"// before\ntransaction_limits.max_order_amount = 10_000; // raw units, too small\n// after\ntransaction_limits.max_order_amount = 10_000_000_000; // sized for token decimals\n","handlingStrategy":"validation","validationCode":"// Rust\nlet base_amount = quantity_to_raw_amount(order.quantity(), base_token.decimals)?;\nif base_amount > U256::from(transaction_limits.max_order_amount) {\n    return Err(anyhow::anyhow!(\"order exceeds max_order_amount\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set max_order_amount consistent with strategy position sizes and token decimals.","Recheck limits after resizing strategies or changing instruments.","Log the configured limits at startup for operators."],"tags":["blockchain","risk-limit","order-size","configuration"],"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-14T05:17:10.506Z"}