nautechsystems/nautilus_trader · error
Database is not initialized, so we cannot bootstrap the pool
Error message
Database is not initialized, so we cannot bootstrap the pool profiler from an RPC snapshot
What it means
bootstrap_pool_profiler_from_rpc_snapshot rebuilds a pool profiler using HyperSync/RPC event data with database-backed checkpoints. Without a database in the cache, the snapshot bootstrap cannot persist/verify watermarks, so it fails before doing work.
Source
Thrown at crates/adapters/blockchain/src/data/core.rs:1580
Ok((profiler, false))
}
/// Bootstraps a pool profiler by reading liquidity topology from HyperSync and state from RPC.
///
/// This mode avoids storing the full swap history. It streams Initialize, Mint, Burn, and
/// fee-protocol updates only, then hydrates the exact target block from the pool contract.
///
/// # Errors
///
/// Returns an error if database is not initialized, event streaming fails, or RPC hydration fails.
pub async fn bootstrap_pool_profiler_from_rpc_snapshot(
&mut self,
pool: &SharedPool,
to_block: u64,
) -> anyhow::Result<(PoolProfiler, bool)> {
if self.cache.database.is_none() {
anyhow::bail!(
"Database is not initialized, so we cannot bootstrap the pool profiler from an RPC snapshot"
);
}
self.construct_pool_profiler_from_hypersync_rpc(
PoolProfiler::new(pool.clone()),
None,
to_block,
)
.await
}
/// Advances an RPC-hydrated profiler to a later checkpoint.
///
/// The profiler must come from [`Self::bootstrap_pool_profiler_from_rpc_snapshot`] or an earlier
/// call to this method. This keeps one command incremental without trusting an unproven stored
/// snapshot as the topology source.
///View on GitHub (pinned to 18893faf8b)
Solutions
- Initialize the cache with a database before calling this method
- Recreate the data client with database enabled
- Fall back to bootstrap_latest_pool_profiler only if it fits (it also requires a DB), or construct the profiler incrementally via advance_pool_profiler_from_rpc_snapshot without DB-dependent bootstrap
Example fix
// before
// cache built without db; bootstrap_pool_profiler_from_rpc_snapshot(...) errors
// after
let cache = Cache::new(db_config.with_database("/data/cache.db"));
client.bootstrap_pool_profiler_from_rpc_snapshot(&pool, to_block).await?; Defensive patterns
Strategy: validation
Validate before calling
ensure!(client.cache_database().is_some(), "rpc snapshot bootstrap requires a configured database"); client.bootstrap_pool_profiler_from_rpc_snapshot(&pool, to_block).await?;
Type guard
fn db_ready(c: &BlockchainDataClient) -> bool { c.cache_database().is_some() } Try / catch
match client.bootstrap_pool_profiler_from_rpc_snapshot(&pool, to_block).await {
Err(e) if e.to_string().contains("Database is not initialized") => {
log::error!("enable cache.database to use RPC snapshot bootstrap");
}
r => r?,
} Prevention
- Initialize the database before any bootstrap_* call
- Add an startup assertion that database config exists when snapshot bootstrap is used
- Keep test fixtures using a real (temp) database rather than None
When it happens
Trigger: Calling bootstrap_pool_profiler_from_rpc_snapshot on a client whose cache.database is None.
Common situations: Same as error 396: in-memory cache for tests, DB config omitted, or DB init failed earlier.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Database is not initialized, so we cannot properly bootstrap
- Fetching on-chain snapshot for Dex protocol {} is not suppor
- RPC tick {tick_value} does not match positions: derived gros
- Fetched block {} while requesting RPC snapshot block {}
- Failed to insert into pool_snapshot table: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/d89f8f92d420b140.
Report an issue: GitHub.