{"record":{"id":"095cd7770781a9bb","repo":"nautechsystems/nautilus_trader","slug":"pool-profiler-for-instrument-id-is-not-initializ","errorCode":null,"errorMessage":"Pool profiler for {instrument_id} is not initialized","messagePattern":"Pool profiler for (.+?) is not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1665,"sourceCode":"            );\n            Some(ceiling)\n        } else {\n            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) {","sourceCodeStart":1647,"sourceCodeEnd":1683,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1647-L1683","documentation":"Quoting the swap locally requires an initialized pool profiler for the instrument; if the profiler exists but is_initialized is false, prepare_swap aborts. The profiler tracks pool state by replaying pool events, and uninitialized means it has not yet processed enough state to compute a reliable quote.","triggerScenarios":"submit_order submitted shortly after startup or after subscribing to a new pool, before the pool profiler has finished initializing from historical pool events (profiler.is_initialized == false).","commonSituations":"Bot restart with an immediate first order before data subscriptions warm up; newly added pool whose historical events are still syncing; data subscription down/slow so the profiler never completes initialization.","solutions":["Wait for the pool profiler to finish initializing (verify is_initialized / check data-subscription health) before submitting orders.","Add a startup readiness gate that blocks order submission until all required pool profilers report initialized.","Check the data subscription for the pool (RPC/indexer) is active and processing events."],"exampleFix":"// before\nclient.submit_order(cmd, &order)?; // may hit uninitialized profiler\n// after\nwait_until(|| client.pool_profiler_initialized(&instrument_id), timeout).await?;\nclient.submit_order(cmd, &order)?;","handlingStrategy":"retry","validationCode":"// Rust\n// gate submission on readiness\nwhile !client.pool_profiler_is_initialized(&instrument_id) {\n    tokio::time::sleep(Duration::from_millis(500)).await;\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch client.submit_order(cmd, &order) {\n    Err(e) if e.to_string().contains(\"not initialized\") => {\n        // back off and retry once profiler syncs\n        tokio::time::sleep(BACKOFF).await;\n    }\n    other => other?,\n}","preventionTips":["Block trading until all required profilers report initialized at startup.","Monitor data-subscription health so profilers keep syncing.","Delay first orders after restart until warmup completes."],"tags":["blockchain","initialization","pool-profiler","warmup"],"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-14T00:17:10.932Z"}