{"record":{"id":"1ff93bb729584218","repo":"linera-io/linera-protocol","slug":"only-supported-scheme-are-http-and-https","errorCode":null,"errorMessage":"Only supported scheme are http and https","messagePattern":"Only supported scheme are http and https","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"linera-service/src/cli_wrappers/local_net.rs","lineNumber":910,"sourceCode":"\n    /// Waits until the gRPC server at the given port responds as healthy.\n    pub async fn ensure_grpc_server_has_started(\n        nickname: &str,\n        port: usize,\n        scheme: &str,\n    ) -> Result<()> {\n        let endpoint = match scheme {\n            \"http\" => Endpoint::new(format!(\"http://localhost:{port}\"))\n                .context(\"endpoint should always parse\")?,\n            \"https\" => {\n                use linera_rpc::CERT_PEM;\n                let certificate = tonic::transport::Certificate::from_pem(CERT_PEM);\n                let tls_config = ClientTlsConfig::new().ca_certificate(certificate);\n                Endpoint::new(format!(\"https://localhost:{port}\"))\n                    .context(\"endpoint should always parse\")?\n                    .tls_config(tls_config)?\n            }\n            _ => bail!(\"Only supported scheme are http and https\"),\n        };\n        let connection = endpoint.connect_lazy();\n        let mut client = HealthClient::new(connection);\n        linera_base::time::timer::sleep(Duration::from_millis(100)).await;\n        for i in 0..10 {\n            linera_base::time::timer::sleep(Duration::from_millis(i * 500)).await;\n            let result = client.check(HealthCheckRequest::default()).await;\n            if result.is_ok() && result.unwrap().get_ref().status() == ServingStatus::Serving {\n                info!(?port, \"Successfully started {nickname}\");\n                return Ok(());\n            } else {\n                warn!(\"Waiting for {nickname} to start\");\n            }\n        }\n        bail!(\"Failed to start {nickname}\");\n    }\n\n    async fn ensure_simple_server_has_started(","sourceCodeStart":892,"sourceCodeEnd":928,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli_wrappers/local_net.rs#L892-L928","documentation":"`ensure_grpc_server_has_started` builds a tonic `Endpoint` for the health check and only understands two scheme strings: 'http' (plaintext gRPC) and 'https' (TLS with the linera test CERT_PEM). Any other scheme falls through to this bail. In-tree callers only pass 'http'/'https' (derived from `Network::Grpc`/`Network::Grpcs`), so hitting it means a custom caller invoked this public helper with a different string.","triggerScenarios":"Calling `LocalNet::ensure_grpc_server_has_started(nickname, port, scheme)` with a scheme like 'grpc', 'grpcs' or 'h2c' instead of 'http'/'https'.","commonSituations":"Custom test harnesses wrapping this public helper; refactors that add a new Network variant without mapping it to one of the two accepted scheme strings.","solutions":["Pass 'http' for plaintext gRPC or 'https' for the net's TLS setup","When mapping a protocol enum, convert to one of the two scheme strings before calling the helper"],"exampleFix":"// before\nLocalNet::ensure_grpc_server_has_started(&nickname, port, \"grpc\").await?;\n\n// after\nLocalNet::ensure_grpc_server_has_started(&nickname, port, \"http\").await?;","handlingStrategy":"validation","validationCode":"const SUPPORTED: [&str; 2] = [\"http\", \"https\"];\nassert!(\n    SUPPORTED.contains(&scheme),\n    \"scheme must be http or https, got {scheme}\"\n);","typeGuard":"fn is_supported_scheme(scheme: &str) -> bool {\n    matches!(scheme, \"http\" | \"https\")\n}","tryCatchPattern":null,"preventionTips":["Map protocol enums to 'http'/'https' at the boundary instead of passing raw protocol names","If you add a Network variant, update every scheme mapping site before running the net helpers"],"tags":["grpc","local-net","url-scheme","cli-wrappers"],"backgroundTag":"invalid-url-scheme","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}