linera-io/linera-protocol · error · anyhow

For Storage service, the formatting has to be service:endpoi

Error message

For Storage service, the formatting has to be service:endpoint:namespace,example service:tcp:127.0.0.1:7878:table_do_my_test

What it means

Raised while parsing a `service:` storage configuration string in `StorageConfig::from_str` (linera-storage-runtime, storage-service feature). The string after the `service:` prefix is empty, so there is no endpoint/namespace to parse. The expected format is `service:tcp:<endpoint>:<port>:<namespace>`, e.g. `service:tcp:127.0.0.1:7878:table_do_my_test`.

Source

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

                    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<_>>();
            if parts.len() != 4 {
                bail!("We should have one endpoint and one namespace");
            }
            let protocol = parts[0];
            if protocol != "tcp" {
                bail!("Only allowed protocol is tcp");
            }
            let endpoint = parts[1];
            let port = parts[2];
            let mut endpoint = endpoint.to_string();
            endpoint.push(':');
            endpoint.push_str(port);
            let endpoint = endpoint.to_string();

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Provide the full endpoint: `service:tcp:127.0.0.1:7878:table_my_test`
  2. Check that the variable holding the endpoint/namespace is actually set before building the string

Example fix

# before
--storage service:

# after
--storage service:tcp:127.0.0.1:7878:table_do_my_test
Defensive patterns

Strategy: validation

Validate before calling

// Rust: reject an empty service endpoint before FromStr
let rest = storage_str.strip_prefix("service:").unwrap_or("");
anyhow::ensure!(!rest.is_empty(), "service storage needs an endpoint: service:tcp:host:port:namespace");

Prevention

When it happens

Trigger: Passing exactly `service:` (or `service` followed only by whitespace) as the storage configuration; building the storage string programmatically and concatenating an empty endpoint.

Common situations: Empty environment variables feeding a storage string template; misconfigured test scripts that default the endpoint to an unset variable.

Related errors


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