linera-io/linera-protocol · error
Cannot apply default storage because the feature 'rocksdb' w
Error message
Cannot apply default storage because the feature 'rocksdb' was not selected
What it means
CommonCliOptions::storage_config() resolves storage in order: --storage CLI arg, then LINERA_STORAGE(_SUFFIX) env var, then a RocksDB default — but the default is only compiled in when the 'rocksdb' feature of linera-service is enabled. This build was made without that feature and neither the flag nor env var was provided, so there is no storage backend to fall back to and the CLI bails.
Source
Thrown at linera-service/src/cli/common_options.rs:94
let storage_env_var = env::var(format!("LINERA_STORAGE{suffix}")).ok();
if let Some(config) = storage_env_var {
return config.parse();
}
cfg_if::cfg_if! {
if #[cfg(feature = "rocksdb")] {
let spawn_mode =
linera_views::rocks_db::RocksDbSpawnMode::get_spawn_mode_from_runtime();
let inner_storage_config = crate::storage::InnerStorageConfig::RocksDb {
path: linera_wallet_json::paths::config_dir()?.join("wallet.db"),
spawn_mode,
};
let namespace = linera_storage::DEFAULT_NAMESPACE.to_string();
Ok(StorageConfig {
inner_storage_config,
namespace,
})
} else {
bail!("Cannot apply default storage because the feature 'rocksdb' was not selected");
}
}
}
/// Returns the path to the wallet file.
pub fn wallet_path(&self) -> Result<PathBuf, Error> {
linera_wallet_json::paths::wallet_path(self.wallet_state_path.as_ref(), &self.suffix())
}
/// Returns the path to the keystore file.
pub fn keystore_path(&self) -> Result<PathBuf, Error> {
linera_wallet_json::paths::keystore_path(self.keystore_path.as_ref(), &self.suffix())
}
/// Reads and returns the wallet.
pub fn wallet(&self) -> Result<Wallet, Error> {
Ok(Wallet::read(&self.wallet_path()?)?)
}View on GitHub (pinned to 6c226ddcb3)
Solutions
- Pass an explicit storage config, e.g. --storage rocksdb:~/my.db:classifier or --storage dynamodb:... matching your backend (or the equivalent service config string).
- Set the LINERA_STORAGE environment variable to the same config string (respects wallet suffixes like LINERA_STORAGE_MYWALLET).
- Or rebuild/install the binary with the rocksdb feature enabled to get the default wallet.db storage back.
- If distributing custom builds, document the required --storage flag in your runbooks.
Example fix
# before $ linera wallet create ... # bails: feature 'rocksdb' not selected # after $ export LINERA_STORAGE="rocksdb:$HOME/.config/linera/wallet.db:benchmark" $ linera wallet create ... # or per-invocation: $ linera --storage rocksdb:/tmp/wallet.db:benchmark wallet create ...
Defensive patterns
Strategy: validation
Validate before calling
// In deployment scripts, fail fast when neither source is set:
: "${LINERA_STORAGE:?this build lacks the rocksdb default; set LINERA_STORAGE or pass --storage}" Try / catch
// Nothing to catch at runtime: fix invocation (pass --storage / set env) or rebuild with the feature.
Prevention
- Always set LINERA_STORAGE explicitly in scripts instead of relying on the compiled-in default.
- Document required cargo features for custom builds of linera-service.
When it happens
Trigger: Running any wallet/storage-dependent linera CLI command on a binary built with default-features=false (or with rocksdb disabled), without passing --storage <config> and without LINERA_STORAGE set. Common with minimal/DynamoDB-only builds used against remote storage.
Common situations: Custom builds or Docker images built with a trimmed feature set; CI jobs reusing a binary compiled for a different storage target; users following docs written against the default (rocksdb-enabled) build.
Related errors
- When storage is not selected, the storage-service needs to b
- Wallet already exists: {}
- Keystore already exists: {}
- cannot have both a json string and file
- Cannot process inbox for follow-only chain {chain_id}. Use `
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/d2171b7a502c786f.
Report an issue: GitHub.