{"record":{"id":"c7d9b1285f14c5ad","repo":"nautechsystems/nautilus_trader","slug":"pool-is-not-initialized-and-it-doesn-t-contain-ini","errorCode":null,"errorMessage":"Pool is not initialized and it doesn't contain initial price, cannot bootstrap profiler","messagePattern":"Pool is not initialized and it doesn't contain initial price, cannot bootstrap profiler","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/data/core.rs","lineNumber":1527,"sourceCode":"                .await;\n        }\n\n        // Sync the pool events before bootstrapping of pool profiler\n        self.sync_pool_events(\n            &pool.dex.name,\n            pool.pool_identifier,\n            None,\n            Some(to_block),\n            false,\n        )\n        .await\n        .context(\"failed to sync pool events for snapshot request\")?;\n\n        if !profiler.is_initialized {\n            if let Some(initial_sqrt_price_x96) = pool.initial_sqrt_price_x96 {\n                profiler.initialize(initial_sqrt_price_x96)?;\n            } else {\n                anyhow::bail!(\n                    \"Pool is not initialized and it doesn't contain initial price, cannot bootstrap profiler\"\n                );\n            }\n        }\n\n        let from_block = from_position\n            .as_ref()\n            .map_or(profiler.pool.creation_block, |block_position| {\n                block_position.number\n            });\n        let total_blocks = to_block.saturating_sub(from_block) + 1;\n\n        // Enable embedded profiler reporting\n        profiler.enable_reporting(from_block, total_blocks, BLOCKS_PROCESS_IN_SYNC_REPORT);\n\n        let mut stream = self.cache.database.as_ref().unwrap().stream_pool_events(\n            pool.chain.clone(),\n            pool.dex.clone(),","sourceCodeStart":1509,"sourceCodeEnd":1545,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/data/core.rs#L1509-L1545","documentation":"After syncing pool events, the profiler must be initialized from either an existing initial sqrt price (initial_sqrt_price_x96) or an initialize event found in history. If the profiler is uninitialized and the pool object lacks initial_sqrt_price_x96, there is no price anchor and bootstrap fails.","triggerScenarios":"bootstrap_latest_pool_profiler on a pool that was never initialized on-chain within the synced history and whose Pool struct has no initial_sqrt_price_x96 recorded.","commonSituations":"Pool created but no swaps/liquidity events yet; pool discovered via a path that doesn't populate initial_sqrt_price_x96; syncing from a block after the pool's initialize event.","solutions":["Provide the pool's initial_sqrt_price_x96 (from its Initialize event) in the pool record","Sync from an earlier block that includes the pool's Initialize event","Use bootstrap_pool_profiler_from_rpc_snapshot if a state snapshot is available","Skip this pool until it is initialized on-chain"],"exampleFix":"// before\npool.initial_sqrt_price_x96 = None;\n// after\npool.initial_sqrt_price_x96 = Some(U256::from(2505413485029675936875037009800u128)); // from Initialize event","handlingStrategy":"validation","validationCode":"if !profiler.is_initialized && pool.initial_sqrt_price_x96.is_none() {\n    return Err(anyhow::anyhow!(\"pool {} has no initial price; cannot bootstrap\", pool.address));\n}","typeGuard":"fn bootstrapable(p: &Pool, prof: &PoolProfiler) -> bool { prof.is_initialized || p.initial_sqrt_price_x96.is_some() }","tryCatchPattern":"match client.bootstrap_latest_pool_profiler(&pool, to_block).await {\n    Err(e) if e.to_string().contains(\"doesn't contain initial price\") => {\n        log::warn!(\"pool {} not initialized yet; retrying later\", pool.address);\n    }\n    r => r?,\n}","preventionTips":["Populate initial_sqrt_price_x96 when discovering pools (capture the Initialize event)","Sync from the pool's creation block when bootstrapping","Defer bootstrapping pools with zero on-chain activity"],"tags":["profiler","pool","initialization","price"],"backgroundTag":"missing-required-argument","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"}