linera-io/linera-protocol · error · anyhow
We should have one endpoint and one namespace
Error message
We should have one endpoint and one namespace
What it means
Raised while parsing a `service:` storage configuration in `StorageConfig::from_str` (linera-storage-runtime, storage-service feature). After `service:` the remainder is split on ':' and must yield exactly 4 parts (protocol, endpoint/host, port, namespace). Any other count — typically a missing namespace or an extra colon — bails here.
Source
Thrown at linera-storage-runtime/src/storage_config.rs:116
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();
let namespace = parts[3].to_string();
let inner_storage_config = InnerStorageConfig::Service { endpoint };
return Ok(StorageConfig {
inner_storage_config,
namespace,
});
}View on GitHub (pinned to 6c226ddcb3)
Solutions
- Append the missing namespace: `service:tcp:127.0.0.1:7878:table_my_test`
- Remove any extra colon-separated segment
- Use an IPv4 host or hostname without colons for the endpoint
Example fix
# before --storage service:tcp:127.0.0.1:7878 # after --storage service:tcp:127.0.0.1:7878:table_do_my_test
Defensive patterns
Strategy: validation
Validate before calling
// Rust: count service segments before FromStr
fn is_valid_service_config(s: &str) -> bool {
match s.strip_prefix("service:") {
Some(rest) => rest.split(':').count() == 4,
None => false,
}
} Prevention
- The namespace is mandatory for service storage — always end with :table_<namespace>
- Avoid colons in hostnames/namespaces (no IPv6 literals)
When it happens
Trigger: Passing `service:tcp:127.0.0.1:7878` (namespace omitted); `service:tcp:127.0.0.1:7878:ns:extra` (5 parts); an IPv6 endpoint whose colons break the naive split.
Common situations: Forgetting the trailing namespace when switching from another backend; changing the endpoint and dropping the last segment; endpoints with colons that the ':'-based parser cannot represent.
Related errors
- For Storage service, the formatting has to be service:endpoi
- We should have one genesis config path and one optional name
- Only allowed protocol is tcp
- For RocksDB, the formatting has to be rocksdb:directory or r
- We should have one, two or three parts
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/255d121fa29fe0ea.
Report an issue: GitHub.