{"record":{"id":"08fc50b9872a9678","repo":"nautechsystems/nautilus_trader","slug":"pool-profiler-for-instrument-id-has-processed-no","errorCode":null,"errorMessage":"Pool profiler for {instrument_id} has processed no events","messagePattern":"Pool profiler for (.+?) has processed no events","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1668,"sourceCode":"            None\n        };\n\n        let profiler = self\n            .core\n            .cache()\n            .pool_profiler(&instrument_id)\n            .cloned()\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"No pool profiler for {instrument_id}; an active data subscription is required to quote the swap\"\n                )\n            })?;\n\n        if !profiler.is_initialized {\n            anyhow::bail!(\"Pool profiler for {instrument_id} is not initialized\");\n        }\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                    );","sourceCodeStart":1650,"sourceCodeEnd":1686,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1650-L1686","documentation":"Even when a pool profiler exists, it must have processed at least one pool event (`last_processed_event` set) to quote reliably. An initialized flag without any processed events yields no usable cursor/liquidity state, so the swap is rejected.","triggerScenarios":"`prepare_swap()` finds a profiler with `is_initialized == true` but `last_processed_event == None` — the profiler was created but no pool events were processed before the quote attempt.","commonSituations":"Submitting orders immediately after subscription before the first event arrives; event stream stalled (RPC/websocket drop) after profiler creation; profiler snapshot restored but history replay not yet started.","solutions":["Wait until the profiler has processed its first event (poll `last_processed_event`) before submitting swaps","Check the pool event stream/WebSocket for stalls and reconnect if no events arrive","Re-trigger history/backfill replay so the profiler ingests past events","Verify the pool actually emits events (active pool) and the subscription filter targets it"],"exampleFix":"// before\nsubmit_order(order); // profiler just created\n// after\nlet profiler = cache.pool_profiler(&id).unwrap();\nassert!(profiler.last_processed_event.is_some(), \"await first pool event\");\nsubmit_order(order);","handlingStrategy":"validation","validationCode":"if let Some(p) = client.cache().pool_profiler(&instrument_id) {\n    if p.last_processed_event.is_none() {\n        return Err(\"profiler has no processed events; wait for first pool event\".into());\n    }\n}","typeGuard":"fn has_processed_events(p: &PoolProfiler) -> bool {\n    p.last_processed_event.is_some()\n}","tryCatchPattern":"match client.submit_order(order).await {\n    Err(e) if e.to_string().contains(\"has processed no events\") => {\n        wait_until(|| profiler(&instrument_id).last_processed_event.is_some()).await?;\n        client.submit_order(order).await\n    }\n    r => r,\n}","preventionTips":["Wait for at least one processed pool event after subscribing before quoting","Monitor event-stream liveness and alert when a profiler goes idle","Ensure backfill/history replay completes before enabling live trading"],"tags":["blockchain","pool-profiler","event-stream","quoting"],"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-23T08:17:48.524Z"}