{"record":{"id":"8b811dbdc55b13ca","repo":"linera-io/linera-protocol","slug":"there-should-be-at-least-one-initial-validator","errorCode":null,"errorMessage":"There should be at least one initial validator","messagePattern":"There should be at least one initial validator","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"linera-service/src/cli_wrappers/local_net.rs","lineNumber":438,"sourceCode":"    async fn instantiate(self) -> Result<(Self::Net, ClientWrapper)> {\n        let storage_config = self.storage_config_builder.build(self.database).await?;\n        let mut net = LocalNet::new(\n            self.network,\n            self.testing_prng_seed,\n            self.namespace,\n            self.num_initial_validators,\n            self.num_proxies,\n            self.num_shards,\n            storage_config,\n            self.cross_chain_config,\n            self.path_provider,\n            self.block_exporters,\n            self.binary_dir,\n            self.export_blocks_to_committee,\n            self.block_export_transport,\n        );\n        let client = net.make_client().await;\n        ensure!(\n            self.num_initial_validators > 0,\n            \"There should be at least one initial validator\"\n        );\n        let total_number_shards = self.num_initial_validators * self.num_shards;\n        ensure!(\n            total_number_shards <= MAX_NUMBER_SHARDS,\n            \"Total number of shards ({}) exceeds maximum allowed ({})\",\n            self.num_shards,\n            MAX_NUMBER_SHARDS\n        );\n        net.generate_initial_validator_config().await?;\n        client\n            .create_genesis_config(\n                self.num_other_initial_chains,\n                self.initial_amount,\n                self.policy_config,\n                self.http_request_allow_list\n                    .clone()","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli_wrappers/local_net.rs#L420-L456","documentation":"LocalNet, the Rust integration-test harness for a local Linera network, computes its shard topology in instantiate() and requires at least one initial validator; with num_initial_validators == 0 there is no committee to generate, so the harness aborts immediately after make_client().","triggerScenarios":"Building a LocalNet whose num_initial_validators is 0 (e.g. `.with_num_initial_validators(0)` or a builder whose field defaults/inputs resolve to 0) and calling instantiate().","commonSituations":"Parameterized test matrices that iterate committee sizes including zero; refactors that read the validator count from an env var or config defaulting to 0.","solutions":["Set at least one initial validator, e.g. `.with_num_initial_validators(4)`, matching your test's committee needs","Skip the test when the configured size is 0 instead of instantiating","Make the test read the count from the same source as the rest of its configuration to avoid divergent defaults"],"exampleFix":"// before\nlet net = builder.with_num_initial_validators(0).build().instantiate().await?; // ensure fails\n\n// after\nlet net = builder.with_num_initial_validators(4).build().instantiate().await?;","handlingStrategy":"validation","validationCode":"assert!(\n    net_builder.num_initial_validators > 0,\n    \"LocalNet requires at least one initial validator\"\n);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate committee size inputs before building LocalNet","Skip parameterized tests at size 0 instead of instantiating","Derive the count from the test's own config to avoid divergent defaults"],"tags":["test-harness","localnet","validators","integration-tests"],"backgroundTag":"empty-validator-set","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}