{"record":{"id":"b11fbd93e692ba16","repo":"Hmbown/CodeWhale","slug":"failed-to-parse-config-at-file-contents-were-o-b11fbd","errorCode":null,"errorMessage":"failed to parse config at {}; file contents were omitted","messagePattern":"failed to parse config at (.+?); file contents were omitted","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":5007,"sourceCode":"}\n\n#[derive(Debug, Clone)]\npub struct ConfigStore {\n    path: PathBuf,\n    pub config: ConfigToml,\n    permissions: PermissionsToml,\n    /// Original file text, retained so [`save`](Self::save) can merge\n    /// comments back after serialisation.\n    original_raw: Option<String>,\n}\n\nimpl ConfigStore {\n    pub fn load(path: Option<PathBuf>) -> Result<Self> {\n        let path = resolve_config_path(path)?;\n        let (config, original_raw) = if checked_path_exists(&path)? {\n            let raw = read_checked_config_file(&path)?;\n            let mut parsed: ConfigToml = toml::from_str(&raw).map_err(|_| {\n                anyhow::anyhow!(\n                    \"failed to parse config at {}; file contents were omitted\",\n                    quote_os_path(&path)\n                )\n            })?;\n            let raw_document: toml::Value = toml::from_str(&raw).map_err(|_| {\n                anyhow::anyhow!(\n                    \"failed to parse config at {}; file contents were omitted\",\n                    quote_os_path(&path)\n                )\n            })?;\n            if let Some(provider_id) = raw_document.get(\"provider\").and_then(toml::Value::as_str) {\n                parsed\n                    .bind_persisted_provider_id(provider_id)\n                    .with_context(|| {\n                        format!(\"failed to parse config at {}\", quote_os_path(&path))\n                    })?;\n            }\n            (parsed, Some(raw))","sourceCodeStart":4989,"sourceCodeEnd":5025,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/config/src/lib.rs#L4989-L5025","documentation":"ConfigStore::load reads the config file and deserializes it into the typed ConfigToml schema. This error means the typed parse failed: the file is either not valid TOML or its values do not match the expected schema (for example a string field holding a table). The underlying toml error and file contents are intentionally dropped so config secrets are not echoed; only the path is quoted.","triggerScenarios":"Loading configuration when config.toml is syntactically invalid TOML, or when known keys carry types or shapes that ConfigToml's serde schema rejects.","commonSituations":"Hand-edited config with a typo; a field changing type between Codewhale versions leaving an old file incompatible; YAML pasted into the TOML file; truncated file after a crash.","solutions":["Run a TOML validator or an editor with TOML lint on the file and fix the reported line","Compare the file's structure against config.example.toml shipped in the repository","If the file was written by a much older version, move it aside, let defaults regenerate, and re-add settings incrementally","If the structure matches the example and it still fails, report a bug with the sanitized file"],"exampleFix":"# before: YAML syntax pasted into config.toml\nmodel:\n  id: glm-4.6\n\n# after: valid TOML\nmodel = \"glm-4.6\"","handlingStrategy":"validation","validationCode":"// Pre-flight: prove the file is at least well-formed TOML before loading:\nfn config_is_well_formed(path: &std::path::Path) -> bool {\n    std::fs::read_to_string(path)\n        .map(|raw| raw.parse::<toml::Value>().is_ok())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"On Err, surface the quoted path and open a repair flow (validator output, compare with config.example.toml); do not silently fall back to defaults, because that would mask user settings.","preventionTips":["Validate config.toml after every manual edit","Read the CHANGELOG schema notes when upgrading before reusing an old file","Never paste YAML or JSON fragments into the TOML file"],"tags":["config","toml","parse","schema"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}