{"record":{"id":"ba5ef01920ebee9f","repo":"linera-io/linera-protocol","slug":"invalid-configuration-file-format","errorCode":null,"errorMessage":"Invalid configuration file format","messagePattern":"Invalid configuration file format","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-exporter/src/main.rs","lineNumber":240,"sourceCode":"\nimpl RunOptions {\n    #[cfg(with_metrics)]\n    fn enable_memory_profiling(&self) -> bool {\n        #[cfg(feature = \"jemalloc\")]\n        {\n            self.enable_memory_profiling\n        }\n        #[cfg(not(feature = \"jemalloc\"))]\n        {\n            false\n        }\n    }\n\n    fn run(&self) -> anyhow::Result<()> {\n        let config_string = fs_err::read_to_string(&self.config_path)\n            .expect(\"Unable to read the configuration file\");\n        let mut config: BlockExporterConfig =\n            toml::from_str(&config_string).expect(\"Invalid configuration file format\");\n\n        let node_options = NodeOptions {\n            send_timeout: self.send_timeout,\n            recv_timeout: self.recv_timeout,\n            retry_delay: self.retry_delay,\n            max_retries: self.max_retries,\n            max_backoff: self.max_backoff,\n        };\n\n        if let Some(port) = self.metrics_port {\n            if IS_WITH_METRICS {\n                tracing::info!(\"overriding metrics port to {}\", port);\n                config.metrics_port = port;\n            } else {\n                tracing::warn!(\n                    \"Metrics are not enabled in this build, ignoring metrics port configuration.\"\n                );\n            }","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-exporter/src/main.rs#L222-L258","documentation":"After reading the config, run parses it with `toml::from_str::<BlockExporterConfig>` and expects success (linera-exporter/src/main.rs:239). The panic fires on TOML syntax errors or when the document does not match BlockExporterConfig's schema: unknown required keys absent, wrong value types, or structural mismatches. The panic message embeds toml's detailed error including line/column, which names the offending key.","triggerScenarios":"Supplying a config whose TOML is malformed (unbalanced brackets, missing quotes) or whose keys/types diverge from BlockExporterConfig - e.g. a missing storage section, a wrong-typed metrics_port, or a config written for a different linera-exporter version.","commonSituations":"Hand-editing the exporter config and breaking syntax; upgrading linera-exporter to a version with a changed config schema while reusing the old file; copying an example config from a mismatched release; YAML-vs-TOML confusion.","solutions":["Read the panic message: it contains the TOML error with line and column pinpointing the bad key.","Validate the file with a TOML linter or `python -c 'import tomllib; tomllib.load(open(\"config.toml\",\"rb\"))'`.","Diff against a known-good example config from the same linera-exporter version (see the repo's example/ or CLI docs).","Regenerate the config for your current version rather than porting one across versions by hand."],"exampleFix":"# before: metrics_port = \"9091\"  (string instead of int -> parse panic)\n\n# after\nmetrics_port = 9091\n[storage]\n# ... keys matching BlockExporterConfig for this version","handlingStrategy":"validation","validationCode":"// Pre-validate before spawning the exporter process:\nlet raw = std::fs::read_to_string(config_path)?;\nlet config: BlockExporterConfig = toml::from_str(&raw)\n    .map_err(|e| anyhow::anyhow!(\"invalid exporter config: {e}\"))?; // surfaced as an error, not a panic","typeGuard":null,"tryCatchPattern":"let parsed = std::panic::catch_unwind(|| toml::from_str::<BlockExporterConfig>(&raw).expect(\"Invalid configuration file format\"));\nif parsed.is_err() {\n    // print toml diagnostics path: run `python -m tomllib` or a TOML linter on the file\n}","preventionTips":["Validate configs in CI with the same linera-exporter version that runs in production.","Keep example configs from the matching release as the canonical template.","Run a TOML syntax check (any linter) as a git pre-commit hook for config files."],"tags":["linera-exporter","config","toml","parse-error","panic"],"backgroundTag":"config-parse-error","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}