linera-io/linera-protocol · error · anyhow

For DualRocksDbScyllaDb, the formatting has to be dualrocksd

Error message

For DualRocksDbScyllaDb, the formatting has to be dualrocksdbscylladb:directory:mode:tcp:hostname:port:namespace

What it means

Raised while parsing a `dualrocksdbscylladb:` storage configuration in `StorageConfig::from_str` (linera-storage-runtime, rocksdb+scylladb features). After the prefix, the remainder is split on ':' and must yield exactly 5 parts (directory:mode:tcp:host:port) or 6 parts (plus namespace); any other count bails with the expected format in the message.

Source

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

                            bail!("the entry \"{part}\" is not matching");
                        }
                    }
                }
            }
            let uri = uri.unwrap_or_else(|| "localhost:9042".to_string());
            let namespace = namespace.unwrap_or_else(|| DEFAULT_NAMESPACE.to_string());
            let inner_storage_config = InnerStorageConfig::ScyllaDb { uri };
            debug!("ScyllaDB connection info: {:?}", inner_storage_config);
            return Ok(StorageConfig {
                inner_storage_config,
                namespace,
            });
        }
        #[cfg(all(feature = "rocksdb", feature = "scylladb"))]
        if let Some(s) = input.strip_prefix(DUAL_ROCKS_DB_SCYLLA_DB) {
            let parts = s.split(':').collect::<Vec<_>>();
            if parts.len() != 5 && parts.len() != 6 {
                bail!(
                    "For DualRocksDbScyllaDb, the formatting has to be dualrocksdbscylladb:directory:mode:tcp:hostname:port:namespace"
                );
            }
            let path = Path::new(parts[0]);
            let path = path.to_path_buf();
            let path_with_guard = PathWithGuard::new(path);
            let spawn_mode_name = parts
                .get(1)
                .copied()
                .expect("validated by the parts length check above");
            let spawn_mode = match spawn_mode_name {
                "spawn_blocking" => Ok(RocksDbSpawnMode::SpawnBlocking),
                "block_in_place" => Ok(RocksDbSpawnMode::BlockInPlace),
                "runtime" => Ok(RocksDbSpawnMode::get_spawn_mode_from_runtime()),
                _ => Err(anyhow!("Failed to parse {spawn_mode_name} as a spawn_mode",)),
            }?;
            let protocol = parts[2];
            if protocol != "tcp" {

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use the exact form `dualrocksdbscylladb:<directory>:<mode>:tcp:<host>:<port>[:<namespace>]`, e.g. `dualrocksdbscylladb:/tmp/db:block_in_place:tcp:127.0.0.1:9042:table_ns`
  2. Count the segments — the tcp URI must be split as `tcp`, `host`, `port` (three segments)
  3. Remove extra colon-separated segments

Example fix

# before
--storage dualrocksdbscylladb:/tmp/db:tcp:127.0.0.1:9042

# after
--storage dualrocksdbscylladb:/tmp/db:block_in_place:tcp:127.0.0.1:9042:table_ns
Defensive patterns

Strategy: validation

Validate before calling

// Rust: pre-validate a dualrocksdbscylladb string before FromStr
fn is_valid_dual_config(s: &str) -> bool {
    match s.strip_prefix("dualrocksdbscylladb:") {
        Some(rest) => {
            let n = rest.split(':').count();
            n == 5 || n == 6
        }
        None => false,
    }
}

Prevention

When it happens

Trigger: Passing `dualrocksdbscylladb:/db` (missing mode/uri segments), or a string with 7+ segments from an extra colon; IPv6 hosts or colon-containing paths breaking the segment count.

Common situations: Hand-assembling the dual-backend string and forgetting the mode or the tcp:host:port tail; copy-pasting from a rocksdb-only config and appending scylla parts incorrectly.

Related errors


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