linera-io/linera-protocol · error · anyhow

We should have one genesis config path and one optional name

Error message

We should have one genesis config path and one optional namespace

What it means

Raised while parsing a `memory:` storage configuration string in `StorageConfig::from_str` (linera-storage-runtime). The in-memory backend expects `memory:<genesis_config_path>` or `memory:<genesis_config_path>:<namespace>`; after splitting on ':', anything other than exactly 1 or 2 parts is rejected. This bail fires when 3+ colon-separated segments follow the prefix.

Source

Thrown at linera-storage-runtime/src/storage_config.rs:96

const DUAL_ROCKS_DB_SCYLLA_DB: &str = "dualrocksdbscylladb:";

impl FromStr for StorageConfig {
    type Err = anyhow::Error;

    fn from_str(input: &str) -> Result<Self, Self::Err> {
        if let Some(s) = input.strip_prefix(MEMORY) {
            let parts = s.split(':').collect::<Vec<_>>();
            if parts.len() == 1 {
                let genesis_path = parts[0].to_string().into();
                let namespace = DEFAULT_NAMESPACE.to_string();
                let inner_storage_config = InnerStorageConfig::Memory { genesis_path };
                return Ok(StorageConfig {
                    inner_storage_config,
                    namespace,
                });
            }
            if parts.len() != 2 {
                bail!("We should have one genesis config path and one optional namespace");
            }
            let genesis_path = parts[0].to_string().into();
            let namespace = parts[1].to_string();
            let inner_storage_config = InnerStorageConfig::Memory { genesis_path };
            return Ok(StorageConfig {
                inner_storage_config,
                namespace,
            });
        }
        #[cfg(feature = "storage-service")]
        if let Some(s) = input.strip_prefix(STORAGE_SERVICE) {
            if s.is_empty() {
                bail!(
                    "For Storage service, the formatting has to be service:endpoint:namespace,\
example service:tcp:127.0.0.1:7878:table_do_my_test"
                );
            }
            let parts = s.split(':').collect::<Vec<_>>();

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use the exact form `memory:<genesis_path>` or `memory:<genesis_path>:<namespace>`
  2. Remove any extra colon-separated segment from the string
  3. Choose a namespace without ':' characters
  4. On Windows, double-check that the drive-letter colon is not followed by another colon

Example fix

# before
--storage memory:./genesis.json:my_ns:extra

# after
--storage memory:./genesis.json:my_ns
Defensive patterns

Strategy: validation

Validate before calling

// Rust: pre-validate a memory storage string before FromStr
fn is_valid_memory_config(s: &str) -> bool {
    let Some(rest) = s.strip_prefix("memory:") else { return false };
    let n = rest.split(':').count();
    n == 1 || n == 2
}

Prevention

When it happens

Trigger: Passing a storage string like `memory:/path/genesis.json:my_ns:extra`, `memory:a:b:c`, or a path/namespace that itself contains colons (e.g. `memory:C:\gen.json:ns` on Windows, or a namespace containing `:`).

Common situations: Typos or trailing colons in `--storage memory:...` CLI arguments; namespaces containing colons; Windows drive-letter paths combined with an explicit namespace; scripts concatenating storage strings with an extra separator.

Related errors


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