{"record":{"id":"0275b9933b4ff455","repo":"nautechsystems/nautilus_trader","slug":"quote-spend-limit-max-amount-max-amount-must","errorCode":null,"errorMessage":"Quote spend limit `max_amount` '{max_amount}' must be a base-10 unsigned integer string","messagePattern":"Quote spend limit `max_amount` '(.+?)' must be a base-10 unsigned integer string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":311,"sourceCode":"            let token_out = validate_address(limit.token_out.as_str())?;\n            let spend_token = validate_address(limit.spend_token.as_str())?;\n\n            if !parsed_pairs.contains(&(token_in, token_out)) {\n                anyhow::bail!(\n                    \"Quote spend limit pair {token_in} -> {token_out} is not in the `allowed_token_pairs` allowlist\"\n                );\n            }\n\n            if spend_token != token_in {\n                anyhow::bail!(\n                    \"Quote spend limit for {token_in} -> {token_out} is denominated in {spend_token}; `spend_token` must match `token_in`\"\n                );\n            }\n\n            if limit.max_amount.is_empty()\n                || !limit.max_amount.bytes().all(|byte| byte.is_ascii_digit())\n            {\n                anyhow::bail!(\n                    \"Quote spend limit `max_amount` '{}' must be a base-10 unsigned integer string\",\n                    limit.max_amount\n                );\n            }\n            let max_amount = U256::from_str(&limit.max_amount).map_err(|_| {\n                anyhow::anyhow!(\n                    \"Quote spend limit `max_amount` '{}' exceeds the U256 range\",\n                    limit.max_amount\n                )\n            })?;\n            let ceiling = QuoteSpendCeiling {\n                spend_token,\n                spend_token_decimals: limit.spend_token_decimals,\n                max_amount,\n            };\n\n            if parsed_quote_spend_limits\n                .insert((token_in, token_out), ceiling)","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L293-L329","documentation":"A quote spend limit's max_amount must be a non-empty base-10 unsigned integer string (no decimals, signs, or hex), because it is parsed as an on-chain U256 raw amount in the token's smallest unit. The library throws this when the string is empty or contains any non-digit bytes, or when U256::from_str overflows.","triggerScenarios":"Calling new/transaction_limits with config.quote_spend_limits entries whose max_amount is \"\", contains '.', '-', 'e', hex chars, whitespace, or exceeds U256::MAX.","commonSituations":"Writing a decimal human amount like \"1.5\" instead of wei-integer \"1500000000000000000\"; using scientific notation \"1e18\"; empty value left by a template; pasting a 0x-prefixed hex amount.","solutions":["Provide max_amount as a decimal integer string of the raw token amount (smallest unit)","Convert decimal/float amounts to integer base units before writing config (multiply by token decimals)","Remove any 0x prefix, sign, decimal point, or exponent characters"],"exampleFix":"// before\nmax_amount = \"1.5\"\n// after\nmax_amount = \"1500000000000000000\"","handlingStrategy":"validation","validationCode":"fn parse_max_amount(s: &str) -> Result<U256, String> {\n    if s.is_empty() || !s.bytes().all(|b| b.is_ascii_digit()) {\n        return Err(format!(\"max_amount '{s}' must be a base-10 unsigned integer string\"));\n    }\n    U256::from_str(s).map_err(|e| format!(\"max_amount '{s}' not representable as U256: {e}\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store amounts as integer strings in the token's smallest unit, never floats or decimals","Provide a CLI/helper to convert human amounts to wei","Document the format next to the config field"],"tags":["config","format","u256"],"backgroundTag":"invalid-argument-format","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"}