{"record":{"id":"a044823371c78232","repo":"nautechsystems/nautilus_trader","slug":"independent-swap-quote-returned-zero","errorCode":null,"errorMessage":"Independent swap quote returned zero","messagePattern":"Independent swap quote returned zero","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":4080,"sourceCode":"                .await\n        }\n        SwapQuoteKind::ExactOutput(amount_out) => {\n            verification\n                .verify_quote_exact_output_single(\n                    &quote_contract,\n                    plan.token_in,\n                    plan.token_out,\n                    amount_out,\n                    plan.fee,\n                    block,\n                )\n                .await\n        }\n    }\n}\n\nfn verified_swap_amounts(plan: &SwapPlan, quote: UniswapV3Quote) -> anyhow::Result<(U256, U256)> {\n    anyhow::ensure!(\n        !quote.amount.is_zero(),\n        \"Independent swap quote returned zero\"\n    );\n    let base_amount =\n        quantity_to_raw_amount(plan.order.quantity(), plan.pool.get_base_token().decimals)?;\n    let slippage_bps = plan.slippage_bps;\n    match plan.order.order_side() {\n        OrderSide::Sell => Ok((\n            base_amount,\n            derive_min_amount_out(quote.amount, slippage_bps)?,\n        )),\n        OrderSide::Buy => {\n            let ceiling = plan.quote_spend_ceiling.ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"No quote spend ceiling for BUY token pair {} -> {}\",\n                    plan.token_in,\n                    plan.token_out\n                )","sourceCodeStart":4062,"sourceCodeEnd":4098,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L4062-L4098","documentation":"This error is thrown in `verified_swap_amounts` (crates/adapters/blockchain/src/execution/client.rs:4080) after the client obtains an independent Uniswap V3 quote from the on-chain Quoter contract. A zero amount out means the quoter could not produce a valid swap result, so the client refuses to proceed rather than build a trade on a meaningless quote.","triggerScenarios":"Calling verify_swap_quote / verified_swap_amounts when the QuoterV2 contract returns amount==0: an ExactOutput request whose desired output exceeds available pool liquidity, an ExactInput so small it rounds to zero, a wrong/stale block number used for quoting, or a token pair/fee tier with no deployed pool.","commonSituations":"Quoting a BUY order on a thin/illiquid pool with insufficient reserves; token address or fee-tier misconfiguration so no real pool exists at that key; quoting against an unfunded testnet deployment; a network fork or stale block head returning degenerate quote data.","solutions":["Check pool liquidity for the token pair/fee tier and use a pool with sufficient reserves for the order size.","Verify plan.token_in, plan.token_out, and plan.fee correspond to an actually deployed pool (see validate_manifest_pool).","Re-run the quote at the current canonical block; ensure the block passed to verify_quote_exact_input_single / verify_quote_exact_output_single is recent.","If the order size legitimately fails, reduce the order quantity so the quote produces a non-zero amount."],"exampleFix":"// before: proceed without checking quote value\nlet quote = verification.verify_quote_exact_output_single(...).await?;\n// after: validate the quote is non-zero and fail fast\nlet quote = verified_value(\n    verification.verify_quote_exact_output_single(...).await,\n    \"independent swap quote\",\n)?;\nanyhow::ensure!(!quote.amount.is_zero(), \"Independent swap quote returned zero\");","handlingStrategy":"validation","validationCode":"fn quote_is_tradeable(q: &UniswapV3Quote) -> bool { !q.amount.is_zero() }","typeGuard":"fn is_valid_quote(q: &UniswapV3Quote) -> bool { !q.amount.is_zero() }","tryCatchPattern":"let quote = client.verify_swap_quote(...).await?;\nif quote.amount.is_zero() {\n    return Err(ExecutionError::UnquotablePool { token_in, token_out, fee });\n}","preventionTips":["Pre-check pool reserves/liquidity for the pair and fee tier before quoting.","Pin quote requests to the latest canonical block and refresh on staleness.","Validate token_in/token_out/fee against the deployment manifest before quoting.","Cap order sizes relative to pool depth so quotes cannot round to zero."],"tags":["blockchain","uniswap-v3","liquidity","quote-validation"],"backgroundTag":"empty-result-set","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"}