linera-io/linera-protocol · error

Not possible to work with memory

Error message

Not possible to work with memory

What it means

`StorageConfigProvider::database()` (used by `linera net up`) maps the configured storage backend to a shared `Database` kind for the local test network. In-memory storage is rejected because a local net spawns several separate server processes (validators, proxies, exporter) that must share persisted state — a process-local in-memory store cannot be shared, so the `InnerStorageConfig::Memory` arm bails immediately.

Source

Thrown at linera-service/src/cli/net_up_utils.rs:86

            #[cfg(not(feature = "storage-service"))]
            Some(storage) => {
                let config = StorageConfig::from_str(storage)?;
                Ok(StorageConfigProvider { config })
            }
        }
    }

    pub fn inner_storage_config(&self) -> &InnerStorageConfig {
        &self.config.inner_storage_config
    }

    pub fn namespace(&self) -> &str {
        &self.config.namespace
    }

    pub fn database(&self) -> anyhow::Result<Database> {
        match self.config.inner_storage_config {
            InnerStorageConfig::Memory { .. } => anyhow::bail!("Not possible to work with memory"),
            #[cfg(feature = "rocksdb")]
            InnerStorageConfig::RocksDb { .. } => {
                anyhow::bail!("Not possible to work with RocksDB")
            }
            #[cfg(feature = "storage-service")]
            InnerStorageConfig::Service { .. } => Ok(Database::Service),
            #[cfg(feature = "scylladb")]
            InnerStorageConfig::ScyllaDb { .. } => Ok(Database::ScyllaDb),
            #[cfg(all(feature = "rocksdb", feature = "scylladb"))]
            InnerStorageConfig::DualRocksDbScyllaDb { .. } => Ok(Database::DualRocksDbScyllaDb),
        }
    }
}

/// Starts a local test network and, optionally, a faucet and block exporter.
#[expect(clippy::too_many_arguments)]
pub async fn handle_net_up_service(
    num_other_initial_chains: u32,

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use a shared backend: `--storage scylladb:...` or `--storage service:<endpoint>`
  2. Omit `--storage` entirely so net up auto-starts a storage-service instance (with the storage-service feature compiled in)
  3. Keep memory storage for single-process tests only, never for multi-process local nets

Example fix

# before
linera net up --storage memory: --other-flags ...

# after
linera net up --storage service:127.0.0.1:12345 --other-flags ...
Defensive patterns

Strategy: validation

Validate before calling

// Reject memory storage before starting a local net.
if matches!(storage_config.inner_storage_config, InnerStorageConfig::Memory { .. }) {
    anyhow::bail!("net up requires a shared backend (service/scylladb); memory cannot be shared across validator processes");
}

Prevention

When it happens

Trigger: Running `linera net up --storage memory...` — any storage config string that parses to `InnerStorageConfig::Memory`.

Common situations: Copying a `--storage memory` flag from single-process unit-test invocations into `net up`; defaulting configs to memory for speed; leftover scripts from memory-compatible commands.

Related errors


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