linera-io/linera-protocol · error

Failed to find address for {s}. {parse_error}

Error message

Failed to find address for {s}. {parse_error}

What it means

For scylladb storage URLs, StorageConfig::from_str splits the part after 'scylladb:' on ':' and processes 'tcp' segments that must contain a hostname and a port. This error means a 'tcp' token was found but the expected address token after it is missing, i.e. the string ends right after 'tcp' or 'tcp:'.

Source

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

                return Ok(StorageConfig {
                    inner_storage_config,
                    namespace,
                });
            }
            bail!("We should have one, two or three parts");
        }
        #[cfg(feature = "scylladb")]
        if let Some(s) = input.strip_prefix(SCYLLA_DB) {
            let mut uri: Option<String> = None;
            let mut namespace: Option<String> = None;
            let parse_error: &'static str = "Correct format is tcp:db_hostname:port.";
            if !s.is_empty() {
                let mut parts = s.split(':');
                while let Some(part) = parts.next() {
                    match part {
                        "tcp" => {
                            let address = parts.next().ok_or_else(|| {
                                anyhow!("Failed to find address for {s}. {parse_error}")
                            })?;
                            let port_str = parts.next().ok_or_else(|| {
                                anyhow!("Failed to find port for {s}. {parse_error}")
                            })?;
                            let port = NonZeroU16::from_str(port_str).map_err(|_| {
                                anyhow!(
                                    "Failed to find parse port {port_str} for {s}. {parse_error}",
                                )
                            })?;
                            if uri.is_some() {
                                bail!("The uri has already been assigned");
                            }
                            uri = Some(format!("{address}:{port}"));
                        }
                        _ if part.starts_with("table") => {
                            if namespace.is_some() {
                                bail!("The namespace has already been assigned");
                            }

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Provide the full endpoint: --storage scylladb:tcp:hostname:9042
  2. If you only wanted the defaults, drop the tcp part entirely — with no tcp segment the config defaults to localhost:9042
  3. Append an optional namespace segment as 'table_<name>' after the port if multiple shards/namespaces share the cluster

Example fix

# before
--storage scylladb:tcp:
# after
--storage scylladb:tcp:db.example.com:9042
Defensive patterns

Strategy: validation

Validate before calling

// Rust: structural check for scylladb tcp segments before calling from_str
fn scylla_segments_ok(s: &str) -> bool {
    let mut parts = s.split(':');
    while let Some(part) = parts.next() {
        if part == "tcp" {
            let addr = parts.next().unwrap_or("");
            let port = parts.next().unwrap_or("");
            if addr.is_empty() || port.is_empty() { return false; }
            if port.parse::<u16>().map(|p| p == 0).unwrap_or(true) { return false; }
        }
    }
    true
}

Type guard

fn is_valid_scylla_config(s: &str) -> bool { s.is_empty() || scylla_segments_ok(s) }

Try / catch

match StorageConfig::from_str(&input) {
    Ok(cfg) => Ok(cfg),
    Err(e) => Err(format!("invalid scylladb storage config {input:?}: {e:#}")),
}

Prevention

When it happens

Trigger: Passing --storage 'scylladb:tcp' or 'scylladb:tcp:' with no hostname. Correct form is 'scylladb:tcp:db_hostname:port' (optionally plus a table namespace, e.g. 'scylladb:tcp:host:9042:table_my_ns').

Common situations: Truncated URL from shell history editing; assuming the port alone suffices; copy-paste from configs of other tools that use 'tcp://' style URLs.

Related errors


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