linera-io/linera-protocol · critical · anyhow

network protocol mismatch: cannot have {internal_protocol} a

Error message

network protocol mismatch: cannot have {internal_protocol} and {external_protocol} 

What it means

Raised in `Proxy::from_context` (linera-service proxy) at startup when the validator configuration mixes protocol families: `config.internal_network.protocol` and `config.validator.network.protocol` must both be `Grpc` or both be `Simple`. Any mixed combination (Grpc internal + Simple external, or Simple internal + Grpc/TLS external) hits the catch-all `bail!` and the proxy process refuses to start. The proxy cannot translate between the gRPC and Simple (TCP/UDP) network stacks, so the configuration is rejected rather than partially run.

Source

Thrown at linera-service/src/proxy/main.rs:214

            (
                NetworkProtocol::Simple(internal_transport),
                NetworkProtocol::Simple(public_transport),
            ) => Self::Simple(Box::new(SimpleProxy {
                internal_config: context
                    .config
                    .internal_network
                    .clone_with_protocol(internal_transport),
                public_config: context
                    .config
                    .validator
                    .network
                    .clone_with_protocol(public_transport),
                send_timeout: context.send_timeout,
                recv_timeout: context.recv_timeout,
                storage,
                id: context.id,
            })),
            _ => bail!("network protocol mismatch: cannot have {internal_protocol} and {external_protocol} "),
        };

        Ok(proxy)
    }
}

#[derive(Debug, Clone)]
pub struct SimpleProxy<S>
where
    S: Storage + Clone + Send + Sync + 'static,
{
    public_config: ValidatorPublicNetworkPreConfig<TransportProtocol>,
    internal_config: ValidatorInternalNetworkPreConfig<TransportProtocol>,
    send_timeout: Duration,
    recv_timeout: Duration,
    storage: S,
    id: usize,
}

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Edit the validator config so both `internal_network.protocol` and `validator.network.protocol` use the same family (both `grpc` or both `simple`)
  2. Regenerate the whole config with `linera configgen` (or the config-generation command used originally) instead of hand-editing one section
  3. Diff the config against a known-good config from the same linera version
  4. Verify each shard's config in a multi-shard setup — one mismatched shard fails the proxy startup

Example fix

# before (config.toml)
[internal_network]
protocol = { type = "grpc", tls = "cleartext" }
[validator.network]
protocol = { type = "simple", transport = "tcp" }

# after
[internal_network]
protocol = { type = "grpc", tls = "cleartext" }
[validator.network]
protocol = { type = "grpc", tls = "cleartext" }
Defensive patterns

Strategy: validation

Validate before calling

// Rust: validate the proxy config before constructing/running the proxy
use linera_base::network::NetworkProtocol;

fn protocols_same_family(internal: &NetworkProtocol, external: &NetworkProtocol) -> bool {
    matches!((internal, external),
        (NetworkProtocol::Grpc { .. }, NetworkProtocol::Grpc(_))
        | (NetworkProtocol::Simple(_), NetworkProtocol::Simple(_)))
}

anyhow::ensure!(
    protocols_same_family(&config.internal_network.protocol, &config.validator.network.protocol),
    "internal and external protocols must both be grpc or both be simple"
);

Prevention

When it happens

Trigger: Running `linera proxy` with a config where `internal_network.protocol` is set to `grpc` while `validator.network.protocol` remains `simple` (or the reverse); hand-editing a generated validator config to change only one side; mixing config fragments produced by different linera-configgen versions.

Common situations: Migrating a validator deployment from Simple to gRPC networking and editing only the internal section; manually assembling config.toml for a proxy shard; copy-pasting network sections between validator configs with different generations.

Related errors


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