linera-io/linera-protocol · error

Cannot run admin operations on the memory store

Error message

Cannot run admin operations on the memory store

What it means

StoreConfig::run_with_store executes admin jobs (RunnableWithStore implementations such as storage initialization/migration) against the configured database. The Memory variant is an in-process, non-persistent store, so admin operations on it are meaningless and rejected outright with this error instead of silently no-op'ing.

Source

Thrown at linera-storage-runtime/src/store_config.rs:204

                Ok(job.run(storage).await)
            }
        }
    }

    /// Connects to the configured key-value store and runs the given
    /// [`RunnableWithStore`] job against it.
    #[allow(unused_variables)]
    pub async fn run_with_store<Job>(
        self,
        cache_sizes: StorageCacheConfig,
        job: Job,
    ) -> Result<Job::Output, anyhow::Error>
    where
        Job: RunnableWithStore,
    {
        match self {
            StoreConfig::Memory { .. } => {
                Err(anyhow!("Cannot run admin operations on the memory store"))
            }
            #[cfg(feature = "storage-service")]
            StoreConfig::StorageService { config, namespace } => Ok(job
                .run::<StorageServiceDatabase>(config, namespace, cache_sizes)
                .await?),
            #[cfg(feature = "rocksdb")]
            StoreConfig::RocksDb { config, namespace } => Ok(job
                .run::<RocksDbDatabase>(config, namespace, cache_sizes)
                .await?),
            #[cfg(feature = "scylladb")]
            StoreConfig::ScyllaDb { config, namespace } => Ok(job
                .run::<ScyllaDbDatabase>(config, namespace, cache_sizes)
                .await?),
            #[cfg(all(feature = "rocksdb", feature = "scylladb"))]
            StoreConfig::DualRocksDbScyllaDb { config, namespace } => Ok(job
                .run::<DualDatabase<RocksDbDatabase, ScyllaDbDatabase, ChainStatesFirstAssignment>>(
                    config,
                    namespace,

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Point the admin command at persistent storage: --storage rocksdb:<path>, scylladb:..., service:... or dualrocksdbscylladb:...
  2. If you were only testing the tool, keep memory storage for node runs but not for admin operations
  3. Check the default storage value of the command — defaults are often memory, so an omitted flag triggers this

Example fix

# before
--storage memory:main.json (admin command)
# after
--storage rocksdb:/tmp/linera-db
Defensive patterns

Strategy: validation

Validate before calling

// Rust: refuse admin jobs on memory storage before calling run_with_store
match &store_config {
    StoreConfig::Memory { .. } => {
        return Err(anyhow::anyhow!("admin operations need persistent storage; pass rocksdb:/scylladb:/service:/dualrocksdbscylladb: config"));
    }
    _ => {}
}
store_config.run_with_store(cache_sizes, job).await

Type guard

fn supports_admin_ops(cfg: &StoreConfig) -> bool {
    !matches!(cfg, StoreConfig::Memory { .. })
}

Try / catch

if let Err(e) = store_config.run_with_store(cache_sizes, job).await {
    if e.to_string().contains("memory store") {
        eprintln!("re-run with a persistent --storage config");
    }
    return Err(e);
}

Prevention

When it happens

Trigger: Calling an admin entry point (e.g. linera-db initialize/migration flows that route through run_with_store) with --storage memory:... . Everything except the Memory variant — storage-service, rocksdb, scylladb, dual — proceeds normally.

Common situations: Copy-pasting a dev quickstart that uses memory storage into an admin command; scripts defaulting to memory for local tests; forgetting to switch the storage flag when moving from running a node to maintaining its database.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/6b5b63bccbc60fbf. Report an issue: GitHub.