{"record":{"id":"ad37dab908c6caff","repo":"nautechsystems/nautilus_trader","slug":"local-quote-for-instrument-id-produced-a-zero-qu","errorCode":null,"errorMessage":"Local quote for {instrument_id} produced a zero quote input","messagePattern":"Local quote for (.+?) produced a zero quote input","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1684,"sourceCode":"        }\n        let profiler_position = profiler.last_processed_event.clone().ok_or_else(|| {\n            anyhow::anyhow!(\"Pool profiler for {instrument_id} has processed no events\")\n        })?;\n\n        let zero_for_one = token_in == pool.token0.address;\n        let (amount_in, quoted_amount_out) = match order.order_side() {\n            OrderSide::Sell => {\n                let quote = profiler\n                    .swap_exact_in(base_amount, zero_for_one, None)\n                    .map_err(|e| anyhow::anyhow!(\"Swap quote failed for {instrument_id}: {e}\"))?;\n                let amount_filled = if zero_for_one {\n                    quote.amount0\n                } else {\n                    quote.amount1\n                };\n\n                if amount_filled != I256::from(base_amount) {\n                    anyhow::bail!(\n                        \"Local quote for {instrument_id} filled {amount_filled} of the {base_amount} order amount; pool liquidity cannot fill the order\"\n                    );\n                }\n                (base_amount, exact_output_amount(&quote, zero_for_one)?)\n            }\n            OrderSide::Buy => {\n                let quote = profiler\n                    .swap_exact_out(base_amount, zero_for_one, None)\n                    .map_err(|e| anyhow::anyhow!(\"Swap quote failed for {instrument_id}: {e}\"))?;\n                let amount_in = quote.get_input_amount();\n                if amount_in.is_zero() {\n                    anyhow::bail!(\"Local quote for {instrument_id} produced a zero quote input\");\n                }\n                let ceiling = quote_spend_ceiling.ok_or_else(|| {\n                    anyhow::anyhow!(\n                        \"No `quote_spend_limits` entry for BUY token pair {token_in} -> {token_out}\"\n                    )\n                })?;","sourceCodeStart":1666,"sourceCodeEnd":1702,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1666-L1702","documentation":"For SELL orders the local quote must fill the full base_amount; the code compares the quote's filled amount (I256) with the order's base_amount and bails when they differ. Note the source excerpt shows this check fires with a distinct \"zero quote input\" message at line 1684 when the quote input computed for the local quote is zero — meaning the simulated swap had nothing to fill against, typically because the computed input amount was zero.","triggerScenarios":"submit_order (SELL path) where the local quote simulation computes a zero input amount, or where amount_filled != base_amount because pool liquidity cannot fill the order size.","commonSituations":"Very small order sizes that round to zero raw units; an illiquid or empty pool that cannot fill the order; stale profiler state producing a degenerate quote.","solutions":["Increase the order quantity so the raw amount is non-zero and representable at base token decimals.","Check the pool's liquidity — use a more liquid pool or split the order.","Verify the pool profiler state is fresh (re-sync) so the local quote simulates against current liquidity."],"exampleFix":"// before\nlet qty = 0.0000001; // rounds to 0 raw units\nclient.submit_order(cmd, &order)?;\n// after\nlet raw = quantity_to_raw_amount(qty, base_token.decimals)?;\nassert!(raw > U256::zero(), \"order quantity rounds to zero\");\nclient.submit_order(cmd, &order)?;","handlingStrategy":"validation","validationCode":"// Rust\nlet raw = quantity_to_raw_amount(order.quantity(), base_token.decimals)?;\nif raw.is_zero() {\n    return Err(anyhow::anyhow!(\"order quantity rounds to zero raw units\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce a minimum order size in raw units per token decimals.","Check pool liquidity before submitting large orders.","Keep profiler state fresh to avoid degenerate quotes."],"tags":["blockchain","liquidity","quote","swap"],"backgroundTag":"insufficient-liquidity","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}