linera-io/linera-protocol · error · anyhow
For RocksDB, the formatting has to be rocksdb:directory or r
Error message
For RocksDB, the formatting has to be rocksdb:directory or rocksdb:directory:spawn_mode:namespace
What it means
Raised while parsing a `rocksdb:` storage configuration in `StorageConfig::from_str` (linera-storage-runtime, rocksdb feature). The string after the `rocksdb:` prefix is empty — no database directory was given. Accepted forms are `rocksdb:<directory>` or `rocksdb:<directory>:<spawn_mode>:<namespace>`.
Source
Thrown at linera-storage-runtime/src/storage_config.rs:138
bail!("Only allowed protocol is tcp");
}
let endpoint = parts[1];
let port = parts[2];
let mut endpoint = endpoint.to_string();
endpoint.push(':');
endpoint.push_str(port);
let endpoint = endpoint.to_string();
let namespace = parts[3].to_string();
let inner_storage_config = InnerStorageConfig::Service { endpoint };
return Ok(StorageConfig {
inner_storage_config,
namespace,
});
}
#[cfg(feature = "rocksdb")]
if let Some(s) = input.strip_prefix(ROCKS_DB) {
if s.is_empty() {
bail!(
"For RocksDB, the formatting has to be rocksdb:directory or rocksdb:directory:spawn_mode:namespace");
}
let parts = s.split(':').collect::<Vec<_>>();
if parts.len() == 1 {
let path = parts[0].to_string().into();
let namespace = DEFAULT_NAMESPACE.to_string();
let spawn_mode = RocksDbSpawnMode::SpawnBlocking;
let inner_storage_config = InnerStorageConfig::RocksDb { path, spawn_mode };
return Ok(StorageConfig {
inner_storage_config,
namespace,
});
}
if parts.len() == 2 || parts.len() == 3 {
let path = parts[0].to_string().into();
let spawn_mode_name = parts
.get(1)
.copied()View on GitHub (pinned to 6c226ddcb3)
Solutions
- Provide the database directory: `rocksdb:/tmp/linera-db`
- Check the variable expansion that produced the empty path
Example fix
# before --storage rocksdb: # after --storage rocksdb:/tmp/linera-db
Defensive patterns
Strategy: validation
Validate before calling
// Rust: reject an empty rocksdb path before FromStr
if storage_str == "rocksdb:" {
anyhow::bail!("rocksdb storage needs a directory: rocksdb:/path/to/db");
} Prevention
- Fail fast on empty directory variables before building the storage string
- Default to a concrete temp directory in test scripts
When it happens
Trigger: Passing exactly `rocksdb:` as the storage string; templating that substitutes an empty directory variable.
Common situations: Empty env vars or unset script variables feeding the `--storage rocksdb:$DB_PATH` argument.
Related errors
- We should have one, two or three parts
- For DualRocksDbScyllaDb, the formatting has to be dualrocksd
- We should have one genesis config path and one optional name
- For Storage service, the formatting has to be service:endpoi
- We should have one endpoint and one namespace
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/d867cbc111689da4.
Report an issue: GitHub.