{"record":{"id":"e508c7977fa8394b","repo":"nautechsystems/nautilus_trader","slug":"unsupported-liquidity-update-operation","errorCode":null,"errorMessage":"Unsupported liquidity update operation {}","messagePattern":"Unsupported liquidity update operation (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/pool.rs","lineNumber":117,"sourceCode":"        if let Some(pool_profiler) = self\n            .cache\n            .borrow_mut()\n            .pool_profiler_mut(&self.instrument_id)\n            && let Err(e) = pool_profiler.process_flash(event)\n        {\n            log::error!(\"Failed to process pool flash: {e}\");\n        }\n    }\n}\n\nfn process_pool_liquidity_update(\n    pool_profiler: &mut PoolProfiler,\n    update: &PoolLiquidityUpdate,\n) -> anyhow::Result<()> {\n    match update.kind {\n        PoolLiquidityUpdateType::Mint => pool_profiler.process_mint(update),\n        PoolLiquidityUpdateType::Burn => pool_profiler.process_burn(update),\n        _ => anyhow::bail!(\"Unsupported liquidity update operation {}\", update.kind),\n    }\n}\n\n/// Handler for pool swap events that delegates to a [`PoolUpdater`].\n#[derive(Debug)]\npub struct PoolSwapHandler {\n    id: Ustr,\n    updater: Rc<PoolUpdater>,\n}\n\nimpl PoolSwapHandler {\n    /// Creates a new swap handler delegating to the given updater.\n    #[must_use]\n    pub fn new(updater: Rc<PoolUpdater>) -> Self {\n        Self {\n            id: Ustr::from(&format!(\"PoolSwapHandler-{}\", updater.id())),\n            updater,\n        }","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/pool.rs#L99-L135","documentation":"Pool liquidity updates in the DeFi pool profiler only support Mint and Burn kinds. Any other PoolLiquidityUpdateType reaching the handler (e.g. Swap arriving on the liquidity channel) has no processing path and is rejected with this error.","triggerScenarios":"Emitting a PoolLiquidityUpdate whose kind is not Mint or Burn into handle_pool_liquidity_update / process_pool_liquidity_update — typically a Swap event routed to the wrong handler, or a newly added enum variant not yet handled.","commonSituations":"Wiring a pool swap stream into the liquidity update handler; a data adapter emitting new update kinds after a version upgrade; deserialization mapping unknown kinds into an unhandled variant.","solutions":["Route Swap (and other non-mint/burn) events to the pool swap handler (PoolSwapHandler) instead of the liquidity update handler.","Filter or transform updates before publishing so only Mint/Burn reach handle_pool_liquidity_update.","Update the adapter/engine if a new PoolLiquidityUpdateType variant was added and needs handling."],"exampleFix":"// before\nif update.kind == PoolLiquidityUpdateType::Swap {\n    handle_pool_liquidity_update(profiler, update)?; // wrong handler\n}\n// after\nmatch update.kind {\n    PoolLiquidityUpdateType::Swap => pool_swap_handler.handle(update),\n    _ => handle_pool_liquidity_update(profiler, update)?,\n}","handlingStrategy":"type-guard","validationCode":"matches!(update.kind, PoolLiquidityUpdateType::Mint | PoolLiquidityUpdateType::Burn)","typeGuard":"fn is_supported_liquidity_kind(k: &PoolLiquidityUpdateType) -> bool {\n    matches!(k, PoolLiquidityUpdateType::Mint | PoolLiquidityUpdateType::Burn)\n}","tryCatchPattern":"match process_pool_liquidity_update(&mut profiler, &update) {\n    Err(e) if e.to_string().contains(\"Unsupported liquidity update\") => {\n        // route to the appropriate handler, e.g. PoolSwapHandler for swaps\n    }\n    r => r?,\n}","preventionTips":["Route swap events to the pool swap handler, not the liquidity update handler","Filter update streams by kind before publishing to the liquidity channel","Re-check match arms when PoolLiquidityUpdateType gains new variants"],"tags":["rust","data-engine","defi","liquidity-pool"],"backgroundTag":"unsupported-enum-value","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"}