{"record":{"id":"14cfcb7de96ea568","repo":"nautechsystems/nautilus_trader","slug":"no-liquidity","errorCode":null,"errorMessage":"No liquidity","messagePattern":"No liquidity","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/model/src/defi/pool_analysis/profiler.rs","lineNumber":1411,"sourceCode":"            amount1,\n            paid0,\n            paid1,\n        );\n\n        Ok(flash_event)\n    }\n\n    /// Core flash loan state update logic.\n    ///\n    /// # Errors\n    ///\n    /// Returns error if:\n    /// - No active liquidity in pool\n    /// - Fee growth arithmetic overflows\n    fn update_flash_state(&mut self, paid0: U256, paid1: U256) -> anyhow::Result<()> {\n        let liquidity = self.tick_map.liquidity;\n        if liquidity == 0 {\n            anyhow::bail!(\"No liquidity\")\n        }\n\n        let fee_protocol_0 = self.state.uniswap_v3_fee_protocol(true);\n        let fee_protocol_1 = self.state.uniswap_v3_fee_protocol(false);\n        let fee_protocol0_basis_points = self.state.fee_protocol_basis_points(true);\n        let fee_protocol1_basis_points = self.state.fee_protocol_basis_points(false);\n\n        // Process token0 fees\n        if paid0 > U256::ZERO {\n            let protocol_fee_0 =\n                Self::protocol_fee_delta(paid0, fee_protocol_0, fee_protocol0_basis_points)?;\n\n            if protocol_fee_0 > U256::ZERO {\n                self.state.protocol_fees_token0 += protocol_fee_0;\n            }\n\n            let lp_fee_0 = paid0 - protocol_fee_0;\n            let delta = FullMath::mul_div(lp_fee_0, Q128, U256::from(liquidity))?;","sourceCodeStart":1393,"sourceCodeEnd":1429,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/defi/pool_analysis/profiler.rs#L1393-L1429","documentation":"update_flash_state advances fee-growth accounting during a flash loan/flash swap and requires in-range liquidity L > 0, because fee growth-per-liquidity values are divided by L. If the pool has no active liquidity the update is impossible, so it bails with \"No liquidity\". process_flash and execute_flash surface this to the caller.","triggerScenarios":"Running a flash simulation (process_flash/execute_flash) against a pool whose tick_map.liquidity is 0 — e.g. an empty range at the current tick, a pool with only out-of-range positions, or an uninitialized/empty pool snapshot.","commonSituations":"Profiling illiquid or new pools with no positions spanning the current tick; replaying a block range before the first mint; pools whose liquidity was all burned before the flash event.","solutions":["Check the pool has active liquidity (tick_map.liquidity > 0) before running flash simulations and skip pools that are empty","Initialize the profiler from a point where liquidity was already minted (skip pre-mint blocks)","Treat the error as 'pool not tradeable' in portfolio logic and exclude the pool from analysis","Verify the tick map/liquidity snapshot was loaded correctly if the pool is known to have liquidity"],"exampleFix":"// before\nprofiler.process_flash(&flash_event)?;\n// after\nif !profiler.has_active_liquidity() {\n    return Ok(None); // nothing to accrue fees against\n}\nprofiler.process_flash(&flash_event)?;","handlingStrategy":"validation","validationCode":"if profiler.tick_map_liquidity() == 0 {\n    return Ok(None); // pool empty at current tick\n}","typeGuard":null,"tryCatchPattern":"match profiler.process_flash(&event) {\n    Err(e) if e.to_string() == \"No liquidity\" => { /* skip empty pool */ }\n    other => other?,\n}","preventionTips":["Skip flash simulations on pools with zero in-range liquidity","Start replay after the pool's first mint","Maintain a pool-liquidity index to filter empty pools early","Re-verify snapshots if a known-liquid pool reports zero liquidity"],"tags":["rust","defi","uniswap-v3","liquidity","flash-loan"],"backgroundTag":"invalid-state-transition","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"}