{"record":{"id":"b4a4475cab5b9f57","repo":"diem/diem","slug":"db-should-open","errorCode":null,"errorMessage":"DB should open.","messagePattern":"DB should open\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"diem-node/src/lib.rs","lineNumber":275,"sourceCode":"\n    let metrics_port = node_config.debug_interface.metrics_server_port;\n    let metric_host = node_config.debug_interface.address.clone();\n    thread::spawn(move || metric_server::start_server(metric_host, metrics_port, false));\n    let public_metrics_port = node_config.debug_interface.public_metrics_server_port;\n    let public_metric_host = node_config.debug_interface.address.clone();\n    thread::spawn(move || {\n        metric_server::start_server(public_metric_host, public_metrics_port, true)\n    });\n\n    let mut instant = Instant::now();\n    let (diem_db, db_rw) = DbReaderWriter::wrap(\n        DiemDB::open(\n            &node_config.storage.dir(),\n            false, /* readonly */\n            node_config.storage.prune_window,\n            node_config.storage.rocksdb_config,\n        )\n        .expect(\"DB should open.\"),\n    );\n    let _simple_storage_service = start_storage_service_with_db(node_config, Arc::clone(&diem_db));\n    let backup_service = start_backup_service(\n        node_config.storage.backup_service_address,\n        Arc::clone(&diem_db),\n    );\n\n    let genesis_waypoint = node_config.base.waypoint.genesis_waypoint();\n    // if there's genesis txn and waypoint, commit it if the result matches.\n    if let Some(genesis) = get_genesis_txn(node_config) {\n        maybe_bootstrap::<DiemVM>(&db_rw, genesis, genesis_waypoint)\n            .expect(\"Db-bootstrapper should not fail.\");\n    } else {\n        info!(\"Genesis txn not provided, it's fine if you don't expect to apply it otherwise please double check config\");\n    }\n\n    debug!(\n        \"Storage service started in {} ms\",","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/diem-node/src/lib.rs#L257-L293","documentation":"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.","triggerScenarios":"DiemDB::open(dir, false, prune_window, rocksdb_config) returns Err — directory not writable/missing, DB locked by another process, or corrupted column families.","commonSituations":"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.","solutions":["Ensure no other process is holding the RocksDB lock (check for a second running node)","Check the storage directory exists and the node user has read/write permissions","Free disk space if full; check for corruption and restore from backup or re-sync","Verify storage.dir() and rocksdb_config in the node config are correct"],"exampleFix":"// before\nDiemDB::open(&node_config.storage.dir(), false, prune_window, rocksdb_config)\n    .expect(\"DB should open.\")\n// after\nlet db = DiemDB::open(&node_config.storage.dir(), false, prune_window, rocksdb_config)\n    .context(format!(\"DB failed to open at {:?}\", node_config.storage.dir()))?;","handlingStrategy":"validation","validationCode":"// preflight: check the dir is writable and not locked before opening the DB\nuse std::fs::OpenOptions;\nlet dir = node_config.storage.dir();\nstd::fs::create_dir_all(dir)?;\nOpenOptions::new().write(true).open(dir.join(\".write_test\"))?;\n// also ensure no other node process holds the RocksDB LOCK file","typeGuard":null,"tryCatchPattern":"let db = DiemDB::open(&node_config.storage.dir(), false, prune_window, rocksdb_config)\n    .unwrap_or_else(|e| {\n        eprintln!(\"DB failed to open at {:?}: {:?} — check lock, permissions, disk\", node_config.storage.dir(), e);\n        std::process::exit(1);\n    });","preventionTips":["Run only one node process per storage directory (RocksDB single-writer lock)","Ensure the storage path exists with correct permissions and free disk space","Use systemd/container supervision to avoid duplicate node starts","Check fsck/disk health after unclean shutdowns"],"tags":["storage","rocksdb","filesystem"],"backgroundTag":"database-open-failed","analyzedSha":"fc4714a8ea273b6efe8b13dbce72ea60aad9a16c","analyzedAt":"2026-09-04T21:07:05.890Z","contentChangedAt":"2026-09-04T21:07:05.890Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}