{"record":{"id":"c02de75a97281eab","repo":"linera-io/linera-protocol","slug":"validator-spec-must-be-in-format-public-key-accou","errorCode":null,"errorMessage":"Validator spec must be in format: public_key,account_key,address,votes","messagePattern":"Validator spec must be in format: public_key,account_key,address,votes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-service/src/cli/command.rs","lineNumber":51,"sourceCode":"/// Specification for a validator to be added to the committee.\n#[derive(Clone, Debug)]\npub struct ValidatorToAdd {\n    /// The validator's public key.\n    pub public_key: ValidatorPublicKey,\n    /// The validator's account public key.\n    pub account_key: AccountPublicKey,\n    /// The network address of the validator.\n    pub address: String,\n    /// The number of votes assigned to the validator.\n    pub votes: u64,\n}\n\nimpl std::str::FromStr for ValidatorToAdd {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        let parts: Vec<&str> = s.split(',').collect();\n        anyhow::ensure!(\n            parts.len() == 4,\n            \"Validator spec must be in format: public_key,account_key,address,votes\"\n        );\n\n        Ok(ValidatorToAdd {\n            public_key: parts[0].parse()?,\n            account_key: parts[1].parse()?,\n            address: parts[2].to_string(),\n            votes: parts[3].parse()?,\n        })\n    }\n}\n\n#[derive(Clone, clap::Args, serde::Serialize)]\n#[serde(rename_all = \"kebab-case\")]\n/// Options controlling the behavior of the benchmark command.\npub struct BenchmarkOptions {\n    /// How many chains to use.","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/command.rs#L33-L69","documentation":"A validator specification passed on the command line did not contain exactly four comma-separated fields. ValidatorToAdd::from_str expects `public_key,account_key,address,votes`, where address is itself a protocol:host:port string and votes is a number; a wrong field count fails before any field is parsed.","triggerScenarios":"Passing only the key pair and address (omitting votes, needed for weighted consensus), a trailing comma creating an empty fifth field, or keys containing/unbalanced delimiters.","commonSituations":"Older docs or scripts that predate the account_key or votes fields; copy-pasting from a table where a column was dropped; forgetting that votes is mandatory even for weight 1.","solutions":["Provide all four fields in order: BLS public key, account key, network address, vote count.","Example shape: --validators \"<public_key>,<account_key>,grpc:host:9000,10\".","Remove trailing/leading commas and spaces around the value.","Confirm both keys are valid hex/base64 for the expected key types before composing the string."],"exampleFix":"# before: missing fields\n--validators \"<public_key>,grpc:host:9000\"\n\n# after: public_key,account_key,address,votes\n--validators \"<public_key>,<account_key>,grpc:host:9000,10\"","handlingStrategy":"type-guard","validationCode":"fn is_valid_validator_spec(s: &str) -> bool {\n    let parts: Vec<_> = s.split(',').collect();\n    parts.len() == 4\n        && parts[0].parse::<PublicKey>().is_ok()\n        && parts[1].parse::<AccountPublicKey>().is_ok()\n        && parts[2].parse::<ValidatorPublicNetworkConfig>().is_ok()\n        && parts[3].parse::<u64>().is_ok()\n}","typeGuard":"fn is_valid_validator_spec(s: &str) -> bool {\n    s.split(',').count() == 4 && !s.split(',').any(str::is_empty)\n}","tryCatchPattern":"match s.parse::<ValidatorToAdd>() {\n    Ok(v) => v,\n    Err(e) => {\n        eprintln!(\"invalid validator spec (want public_key,account_key,address,votes): {e}\");\n        std::process::exit(2);\n    }\n}","preventionTips":["Build the spec string from typed values with format!(\"{pk},{ak},{addr},{votes}\").","Add a config-lint step that parses every validator spec before deployment."],"tags":["cli","parsing","validator","config"],"backgroundTag":"invalid-cli-argument-format","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}