linera-io/linera-protocol · error
Invalid options file format: \n {options_string}
Error message
Invalid options file format: \n {options_string} What it means
The server's run function reads each validator options file and parses it with toml::from_str into ValidatorOptions. Parsing failures (bad TOML syntax, wrong types, unknown/missing fields such as server_config_path) panic with 'Invalid options file format' along with the full file contents. This runs during validator/proxy configuration generation, not during normal serving.
Source
Thrown at linera-service/src/server.rs:898
.boxed()
.await
.unwrap()
.unwrap();
}
ServerCommand::Generate {
validators,
committee,
testing_prng_seed,
} => {
let mut config_validators = Vec::new();
let mut rng = Box::<dyn CryptoRng>::from(testing_prng_seed);
for options_path in validators {
let options_string = fs_err::tokio::read_to_string(options_path)
.await
.expect("Unable to read validator options file");
let options: ValidatorOptions = toml::from_str(&options_string)
.unwrap_or_else(|_| panic!("Invalid options file format: \n {options_string}"));
let path = options.server_config_path.clone();
let mut server = make_server_config(&path, &mut rng, options)
.expect("Unable to open server config file");
Persist::persist(&mut server)
.await
.expect("Unable to write server config file");
info!("Wrote server config {}", path.to_str().unwrap());
println!(
"{},{}",
server.validator.public_key, server.validator.account_key
);
config_validators.push(Persist::into_value(server).validator);
}
if let Some(committee) = committee {
let mut config = persistent::File::new(
&committee,
CommitteeConfig {
validators: config_validators,View on GitHub (pinned to 6c226ddcb3)
Solutions
- Validate the file parses as TOML first (e.g. python -c 'import tomllib;tomllib.load(open("opts.toml","rb"))' or toml2json)
- Match ValidatorOptions' expected fields exactly (including server_config_path) as shown in the repo's example configs
- Fix syntax errors reported by the panic message, which echoes the offending file contents
- Prefer generating options files with the provided CLI/tooling instead of hand-writing them
Example fix
# before (opts.toml) server_config_path = 1234 # wrong type # after server_config_path = "/path/to/server.config"
Defensive patterns
Strategy: validation
Validate before calling
// Validate the options file before passing it to the server:
let raw = std::fs::read_to_string(options_path)?;
let _opts: ValidatorOptions = toml::from_str(&raw)
.map_err(|e| anyhow::anyhow!("{options_path} is not a valid options file: {e}"))?; Prevention
- Template options files from the repo examples and lint TOML in CI
- Prefer generated configs over hand-edited ones
- Include the options file in config integration tests so schema drift fails early
When it happens
Trigger: Invoking the server run path with one or more --options/-o files whose TOML does not deserialize into ValidatorOptions: syntax errors, keys with wrong value types, or files that are actually JSON/YAML.
Common situations: Hand-editing a validator options template and breaking syntax (unclosed quotes/brackets); switching config tooling that emits a different format; renaming fields per newer docs while the binary expects the documented ValidatorOptions shape; trailing commas.
Related errors
- Failed to read server config
- Invalid RUST_LOG_FORMAT: `{format}`. Valid values are `json
- Fail to read server config
- invalid block export configuration
- invalid block export configuration: {message}
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/dd60d1decbc7389e.
Report an issue: GitHub.