linera-io/linera-protocol · error

Only allowed options are grpc and grpcs

Error message

Only allowed options are grpc and grpcs

What it means

handle_net_up_service maps the --external-protocol string to a Network value for the local test network's proxy. Only 'grpc' (plaintext gRPC) and 'grpcs' (TLS gRPC) are recognized; any other string panics with 'Only allowed options are grpc and grpcs'.

Source

Thrown at linera-service/src/cli/net_up_utils.rs:142

        "The local test network must have at least one validator."
    );
    assert!(
        num_shards >= 1,
        "The local test network must have at least one shard per validator."
    );

    let shutdown_notifier = CancellationToken::new();
    tokio::spawn(listen_for_shutdown_signals(shutdown_notifier.clone()));

    let storage = StorageConfigProvider::new(storage).await?;
    let storage_config = storage.inner_storage_config().clone();
    let namespace = storage.namespace().to_string();
    let database = storage.database()?;
    let storage_config_builder = InnerStorageConfigBuilder::ExistingConfig { storage_config };
    let external = match external_protocol.as_str() {
        "grpc" => Network::Grpc,
        "grpcs" => Network::Grpcs,
        _ => panic!("Only allowed options are grpc and grpcs"),
    };
    let internal = Network::Grpc;
    let network = NetworkConfig { external, internal };
    let path_provider = PathProvider::from_path_option(path)?;
    let num_proxies = 1; // Local networks currently support exactly 1 proxy.
    let block_exporters = ExportersSetup::new(
        with_block_exporter,
        block_exporter_address,
        block_exporter_port,
    );
    let initial_amount = Amount::from_tokens(initial_amount);
    let config = LocalNetConfig {
        block_export_transport: crate::config::BlockExportTransport::Relay,
        export_blocks_to_committee: false,
        network,
        database,
        testing_prng_seed,
        namespace,

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use exactly grpc or grpcs (lowercase, no surrounding whitespace)
  2. If you want plain HTTP/JSON for a local test, that is not configurable here — use grpc and query via the GraphQL endpoint instead
  3. Quote and validate variables in wrapper scripts before passing them to the CLI

Example fix

# before
linera net up --external-protocol http

# after
linera net up --external-protocol grpc
Defensive patterns

Strategy: validation

Validate before calling

const EXTERNAL_PROTOCOLS: [&str; 2] = ["grpc", "grpcs"];
assert!(
    EXTERNAL_PROTOCOLS.contains(&external_protocol),
    "--external-protocol must be one of {EXTERNAL_PROTOCOLS:?}"
);

Prevention

When it happens

Trigger: Running `linera net up --external-protocol <value>` with anything other than grpc or grpcs — e.g. 'grpc-web', 'http', 'h2', a typo like 'grpcs ' with whitespace, or the wrong case ('Grpc').

Common situations: Scripts written for an older CLI that accepted other protocol names; copy-pasted commands from docs describing other deployments; shell variable expansion injecting unexpected values.

Related errors


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