nautechsystems/nautilus_trader · error

Pool is not initialized and it doesn't contain initial price

Error message

Pool is not initialized and it doesn't contain initial price, cannot bootstrap profiler

What it means

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.

Source

Thrown at crates/adapters/blockchain/src/data/core.rs:1527

                .await;
        }

        // Sync the pool events before bootstrapping of pool profiler
        self.sync_pool_events(
            &pool.dex.name,
            pool.pool_identifier,
            None,
            Some(to_block),
            false,
        )
        .await
        .context("failed to sync pool events for snapshot request")?;

        if !profiler.is_initialized {
            if let Some(initial_sqrt_price_x96) = pool.initial_sqrt_price_x96 {
                profiler.initialize(initial_sqrt_price_x96)?;
            } else {
                anyhow::bail!(
                    "Pool is not initialized and it doesn't contain initial price, cannot bootstrap profiler"
                );
            }
        }

        let from_block = from_position
            .as_ref()
            .map_or(profiler.pool.creation_block, |block_position| {
                block_position.number
            });
        let total_blocks = to_block.saturating_sub(from_block) + 1;

        // Enable embedded profiler reporting
        profiler.enable_reporting(from_block, total_blocks, BLOCKS_PROCESS_IN_SYNC_REPORT);

        let mut stream = self.cache.database.as_ref().unwrap().stream_pool_events(
            pool.chain.clone(),
            pool.dex.clone(),

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Provide the pool's initial_sqrt_price_x96 (from its Initialize event) in the pool record
  2. Sync from an earlier block that includes the pool's Initialize event
  3. Use bootstrap_pool_profiler_from_rpc_snapshot if a state snapshot is available
  4. Skip this pool until it is initialized on-chain

Example fix

// before
pool.initial_sqrt_price_x96 = None;
// after
pool.initial_sqrt_price_x96 = Some(U256::from(2505413485029675936875037009800u128)); // from Initialize event
Defensive patterns

Strategy: validation

Validate before calling

if !profiler.is_initialized && pool.initial_sqrt_price_x96.is_none() {
    return Err(anyhow::anyhow!("pool {} has no initial price; cannot bootstrap", pool.address));
}

Type guard

fn bootstrapable(p: &Pool, prof: &PoolProfiler) -> bool { prof.is_initialized || p.initial_sqrt_price_x96.is_some() }

Try / catch

match client.bootstrap_latest_pool_profiler(&pool, to_block).await {
    Err(e) if e.to_string().contains("doesn't contain initial price") => {
        log::warn!("pool {} not initialized yet; retrying later", pool.address);
    }
    r => r?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/c7d9b1285f14c5ad. Report an issue: GitHub.