{"record":{"id":"d54439aa7256e51f","repo":"linera-io/linera-protocol","slug":"failed-to-read-server-config","errorCode":null,"errorMessage":"Failed to read server config","messagePattern":"Failed to read server config","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"linera-service/src/server.rs","lineNumber":771,"sourceCode":"fn otlp_exporter_endpoint_for(command: &ServerCommand) -> Option<&str> {\n    match command {\n        ServerCommand::Run {\n            otlp_exporter_endpoint,\n            ..\n        } => otlp_exporter_endpoint.as_deref(),\n        ServerCommand::Generate { .. } | ServerCommand::EditShards { .. } => None,\n    }\n}\n\nfn log_file_name_for(command: &ServerCommand) -> Cow<'static, str> {\n    match command {\n        ServerCommand::Run {\n            shard,\n            server_config_path,\n            ..\n        } => {\n            let server_config: ValidatorServerConfig =\n                util::read_json(server_config_path).expect(\"Failed to read server config\");\n            let public_key = &server_config.validator.public_key;\n\n            if let Some(shard) = shard {\n                format!(\"validator-{public_key}-shard-{shard}\")\n            } else {\n                format!(\"validator-{public_key}\")\n            }\n            .into()\n        }\n        ServerCommand::Generate { .. } | ServerCommand::EditShards { .. } => \"server\".into(),\n    }\n}\n\nasync fn run(options: ServerOptions) {\n    linera_service::tracing::opentelemetry::init(\n        &log_file_name_for(&options.command),\n        otlp_exporter_endpoint_for(&options.command),\n    );","sourceCodeStart":753,"sourceCodeEnd":789,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/server.rs#L753-L789","documentation":"Before running a shard, the server derives its log file name from the validator public key, which requires reading the server config with util::read_json(server_config_path).expect(\"Failed to read server config\"). The panic occurs during log-name computation when the config file is missing, unreadable, or not valid ValidatorServerConfig JSON — the process dies before any worker starts.","triggerScenarios":"Running `linera server run --server-config-path <path>` where <path> does not exist, has bad permissions, holds malformed JSON, or a schema that no longer deserializes into ValidatorServerConfig.","commonSituations":"Deploying a new validator shard without first creating its server config; upgrading Linera so the config schema changed; container images where the config mount is missing; path typos in launch scripts.","solutions":["Verify the config path exists and is readable (ls -l, absolute path preferred)","Validate JSON syntax and structure with jq against a known-good ValidatorServerConfig","Regenerate the config with the current version's tooling before starting the shard","In orchestration, add a pre-flight check (test -f / jq -e .) that fails the unit with a clear message instead of a panic"],"exampleFix":"# before\nlinera server run --shard 0 --server-config-path server.json\n\n# after\ntest -f /etc/linera/server.json && jq -e .validator.public_key /etc/linera/server.json\nlinera server run --shard 0 --server-config-path /etc/linera/server.json","handlingStrategy":"validation","validationCode":"# Validate before launch.\nCONF=/etc/linera/server.json\ntest -r \"$CONF\" && jq -e '.validator.public_key' \"$CONF\" >/dev/null \\\n  || { echo \"server config missing/invalid: $CONF\" >&2; exit 1; }\nlinera server run --shard 0 --server-config-path \"$CONF\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store server configs at fixed absolute paths referenced by launch scripts","jq-check the validator public_key presence after every edit","Recreate configs on Linera upgrades instead of carrying old files forward","Include config validation in container entrypoints"],"tags":["linera","server","validator","config-file","logging","startup"],"backgroundTag":"config-file-invalid","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}