linera-io/linera-protocol · error

{s}

Error message

{s}

What it means

The address had the right protocol:host:port shape, but the protocol token failed to parse; the error re-displays the inner NetworkProtocol parse message, typically `unsupported protocol: "xyz"`. Only tcp, udp, grpc and grpcs are accepted, and tcp/udp additionally require a binary built with the simple-network feature.

Source

Thrown at linera-rpc/src/config.rs:280

            },
        }
    }
}

impl<P> std::str::FromStr for ValidatorPublicNetworkPreConfig<P>
where
    P: std::str::FromStr,
    P::Err: std::fmt::Display,
{
    type Err = anyhow::Error;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let parts = s.split(':').collect::<Vec<_>>();
        anyhow::ensure!(
            parts.len() == 3,
            "Expecting format `(tcp|udp|grpc|grpcs):host:port`"
        );
        let protocol = parts[0].parse().map_err(|s| anyhow::anyhow!("{s}"))?;
        let host = parts[1].to_owned();
        let port = parts[2].parse()?;
        Ok(ValidatorPublicNetworkPreConfig {
            protocol,
            host,
            port,
        })
    }
}

impl std::str::FromStr for NetworkProtocol {
    type Err = String;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let protocol = match s {
            "grpc" => Self::Grpc(TlsConfig::ClearText),
            "grpcs" => Self::Grpc(TlsConfig::Tls),
            #[cfg(with_simple_network)]

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use one of the exact lowercase tokens: tcp, udp, grpc (plaintext) or grpcs (TLS).
  2. For HTTP-style endpoints, pick grpc/grpcs — validators do not speak http.
  3. If tcp/udp is rejected in a custom build, rebuild with the simple-network feature or switch the validator to grpc.
  4. Check for invisible whitespace or a capital first letter in the protocol segment.

Example fix

# before: protocol token not supported by NetworkProtocol::from_str
"http:validator1:9000"    # -> unsupported protocol: "http"

# after: accepted tokens only
"grpc:validator1:9000"
"grpcs:validator1:9000"
Defensive patterns

Strategy: validation

Validate before calling

const PROTOCOLS: &[&str] = &["tcp", "udp", "grpc", "grpcs"];
let proto = s.split(':').next().unwrap_or_default();
ensure!(
    PROTOCOLS.contains(&proto),
    "protocol must be one of tcp|udp|grpc|grpcs, got {proto:?}"
);

Type guard

fn is_known_protocol(p: &str) -> bool {
    matches!(p, "tcp" | "udp" | "grpc" | "grpcs")
}

Prevention

When it happens

Trigger: parts[0] is something like "http", "ws", or "GRPC" (case-sensitive); or the value says "tcp"/"udp" while the linera binary was compiled without `with_simple_network`, in which case even valid tokens are rejected.

Common situations: Reusing URLs from RPC/REST docs (http/https) for validator addresses; assuming case-insensitivity; feature-flag differences between release and custom builds of linera-rpc.

Related errors


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