linera-io/linera-protocol · error · anyhow

Only allowed protocol is tcp

Error message

Only allowed protocol is tcp

What it means

Raised while parsing a `service:` storage configuration in `StorageConfig::from_str` (linera-storage-runtime). The first segment after `service:` must be the literal `tcp`; the storage-service client only supports raw TCP transport, so any other scheme (http, https, ws, grpc) is rejected.

Source

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

                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();
            let namespace = parts[3].to_string();
            let inner_storage_config = InnerStorageConfig::Service { endpoint };
            return Ok(StorageConfig {
                inner_storage_config,
                namespace,
            });
        }
        #[cfg(feature = "rocksdb")]
        if let Some(s) = input.strip_prefix(ROCKS_DB) {
            if s.is_empty() {
                bail!(

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Change the transport segment to `tcp`: `service:tcp:<host>:<port>:<namespace>`
  2. Verify the storage service is actually listening on a plain TCP endpoint (it is started with `--endpoint tcp:host:port`)

Example fix

# before
--storage service:http:127.0.0.1:7878:table_ns

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

Strategy: validation

Validate before calling

// Rust: check the transport segment before FromStr
if let Some(rest) = storage_str.strip_prefix("service:") {
    let protocol = rest.split(':').next().unwrap_or("");
    anyhow::ensure!(protocol == "tcp", "service storage only supports tcp, got {protocol}");
}

Prevention

When it happens

Trigger: Passing `service:http:127.0.0.1:7878:ns`, `service:grpc:...`, or any scheme other than `tcp` as the transport segment.

Common situations: Copy-pasting an HTTP URL scheme from service documentation into the storage string; assuming the storage service speaks the same protocol as the node's GraphQL endpoint.

Related errors


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