diem/diem · critical

DB should open.

Error message

DB should open.

What it means

DiemDB::open() panicked because the RocksDB database could not be opened in node_config.storage.dir(). This expect is the node's hard requirement that storage is openable read-write at startup; failure aborts setup_environment.

Source

Thrown at diem-node/src/lib.rs:275

    let metrics_port = node_config.debug_interface.metrics_server_port;
    let metric_host = node_config.debug_interface.address.clone();
    thread::spawn(move || metric_server::start_server(metric_host, metrics_port, false));
    let public_metrics_port = node_config.debug_interface.public_metrics_server_port;
    let public_metric_host = node_config.debug_interface.address.clone();
    thread::spawn(move || {
        metric_server::start_server(public_metric_host, public_metrics_port, true)
    });

    let mut instant = Instant::now();
    let (diem_db, db_rw) = DbReaderWriter::wrap(
        DiemDB::open(
            &node_config.storage.dir(),
            false, /* readonly */
            node_config.storage.prune_window,
            node_config.storage.rocksdb_config,
        )
        .expect("DB should open."),
    );
    let _simple_storage_service = start_storage_service_with_db(node_config, Arc::clone(&diem_db));
    let backup_service = start_backup_service(
        node_config.storage.backup_service_address,
        Arc::clone(&diem_db),
    );

    let genesis_waypoint = node_config.base.waypoint.genesis_waypoint();
    // if there's genesis txn and waypoint, commit it if the result matches.
    if let Some(genesis) = get_genesis_txn(node_config) {
        maybe_bootstrap::<DiemVM>(&db_rw, genesis, genesis_waypoint)
            .expect("Db-bootstrapper should not fail.");
    } else {
        info!("Genesis txn not provided, it's fine if you don't expect to apply it otherwise please double check config");
    }

    debug!(
        "Storage service started in {} ms",

View on GitHub (pinned to fc4714a8ea)

Solutions

  1. Ensure no other process is holding the RocksDB lock (check for a second running node)
  2. Check the storage directory exists and the node user has read/write permissions
  3. Free disk space if full; check for corruption and restore from backup or re-sync
  4. Verify storage.dir() and rocksdb_config in the node config are correct

Example fix

// before
DiemDB::open(&node_config.storage.dir(), false, prune_window, rocksdb_config)
    .expect("DB should open.")
// after
let db = DiemDB::open(&node_config.storage.dir(), false, prune_window, rocksdb_config)
    .context(format!("DB failed to open at {:?}", node_config.storage.dir()))?;
Defensive patterns

Strategy: validation

Validate before calling

// preflight: check the dir is writable and not locked before opening the DB
use std::fs::OpenOptions;
let dir = node_config.storage.dir();
std::fs::create_dir_all(dir)?;
OpenOptions::new().write(true).open(dir.join(".write_test"))?;
// also ensure no other node process holds the RocksDB LOCK file

Try / catch

let db = DiemDB::open(&node_config.storage.dir(), false, prune_window, rocksdb_config)
    .unwrap_or_else(|e| {
        eprintln!("DB failed to open at {:?}: {:?} — check lock, permissions, disk", node_config.storage.dir(), e);
        std::process::exit(1);
    });

Prevention

When it happens

Trigger: DiemDB::open(dir, false, prune_window, rocksdb_config) returns Err — directory not writable/missing, DB locked by another process, or corrupted column families.

Common situations: Two node processes using the same data dir (LOCK file held); permission denied on the storage path; disk full; RocksDB corruption after unclean shutdown; path misconfigured in node config.

Related errors


AI-assisted analysis of diem/diem@fc4714a8ea (2026-09-04). Data as JSON: /api/errors/b4a4475cab5b9f57. Report an issue: GitHub.