nautechsystems/nautilus_trader · error
Database is not initialized, so we cannot properly bootstrap
Error message
Database is not initialized, so we cannot properly bootstrap the latest pool profiler
What it means
bootstrap_latest_pool_profiler replays historical pool events and persists state, which requires the cache's database. When cache.database is None (no DB configured), bootstrap cannot produce a correct profiler, so it fails explicitly instead of returning a profiler without history.
Source
Thrown at crates/adapters/blockchain/src/data/core.rs:1482
/// # Errors
///
/// Returns an error if database is not initialized or event processing fails.
///
/// # Panics
///
/// Panics if the database reference is unavailable.
pub async fn bootstrap_latest_pool_profiler(
&mut self,
pool: &SharedPool,
to_block: Option<u64>,
) -> anyhow::Result<(PoolProfiler, bool)> {
log::debug!(
"Bootstrapping latest pool profiler for pool {}",
pool.address
);
if self.cache.database.is_none() {
anyhow::bail!(
"Database is not initialized, so we cannot properly bootstrap the latest pool profiler"
);
}
let to_block = match to_block {
Some(block) => block,
None => self.hypersync_client.current_block().await,
};
let (mut profiler, from_position) = self
.seed_pool_profiler_from_latest_snapshot(pool, to_block)
.await?;
// If we don't have never synced pool events, proceed with faster
// construction of pool profiler from hypersync and RPC, where we
// dont need syncing of pool events and fetching it from database
if self
.cache
.databaseView on GitHub (pinned to 18893faf8b)
Solutions
- Configure and initialize the cache database (e.g. RocksDB/SQLite path) before bootstrapping
- Recreate the data client with database enabled
- If no persistence is desired, avoid bootstrap and construct the profiler from an RPC snapshot or from scratch
Example fix
// before
let cache = Cache::new(memory_config); // database: None
// after
let cache = Cache::new(db_config.with_database("/data/cache.db")); Defensive patterns
Strategy: validation
Validate before calling
if client.cache_database().is_none() {
return Err(anyhow::anyhow!("bootstrap requires a cache database; configure one first"));
}
client.bootstrap_latest_pool_profiler(&pool, None).await?; Type guard
fn has_database(c: &BlockchainDataClient) -> bool { c.cache_database().is_some() } Try / catch
match client.bootstrap_latest_pool_profiler(&pool, to_block).await {
Err(e) if e.to_string().contains("Database is not initialized") => {
log::error!("configure cache.database before bootstrapping");
}
r => r?,
} Prevention
- Enable the cache database in all profiles that use bootstrap APIs
- Fail fast at startup if database config is missing
- Document that in-memory caches cannot bootstrap profilers
When it happens
Trigger: Calling bootstrap_latest_pool_profiler on a client whose cache was constructed without a database (in-memory cache only).
Common situations: Running with an in-memory/temporary cache for quick tests; DB config omitted; DB failed to open earlier so database stayed None.
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
- Pool is not initialized and it doesn't contain initial price
- Database is not initialized, so we cannot bootstrap the pool
- Failed to initialize finalized header ledger: {e}
- Execution payload state is missing
- Canonical nonce ledger is not initialized
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/dbe6c6d021d52d8f.
Report an issue: GitHub.