{"record":{"id":"f283aa777590062e","repo":"Hmbown/CodeWhale","slug":"failed-to-parse-config-toml-while-clearing-retired-provider","errorCode":null,"errorMessage":"failed to parse config TOML while clearing retired provider state; file contents were omitted","messagePattern":"failed to parse config TOML while clearing retired provider state; file contents were omitted","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":5504,"sourceCode":"        format!(\n            \"failed to clear retired provider state from config backup {}\",\n            backup.display()\n        )\n    })?;\n    if scrubbed != raw {\n        persistence::atomic_write(&backup, scrubbed.as_bytes()).with_context(|| {\n            format!(\n                \"failed to write retired-provider-free config backup {}\",\n                backup.display()\n            )\n        })?;\n    }\n    Ok(())\n}\n\nfn config_toml_without_legacy_antigravity(raw: &str) -> Result<String> {\n    let mut document = raw.parse::<toml_edit::DocumentMut>().map_err(|_| {\n        anyhow::anyhow!(\n            \"failed to parse config TOML while clearing retired provider state; file contents were omitted\"\n        )\n    })?;\n    let root = document.as_table_mut();\n\n    if root\n        .get(\"provider\")\n        .and_then(toml_edit::Item::as_str)\n        .is_some_and(is_legacy_antigravity_name)\n    {\n        root.remove(\"provider\");\n    }\n    if let Some(fallbacks) = root\n        .get_mut(\"fallback_providers\")\n        .and_then(toml_edit::Item::as_array_mut)\n    {\n        fallbacks.retain(|value| !value.as_str().is_some_and(is_legacy_antigravity_name));\n        if fallbacks.is_empty() {","sourceCodeStart":5486,"sourceCodeEnd":5522,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/config/src/lib.rs#L5486-L5522","documentation":"config_toml_without_legacy_antigravity parses the raw config with toml_edit::DocumentMut to surgically remove retired provider state while preserving formatting. If the raw text is not valid TOML, the error is thrown with file contents omitted to avoid leaking secrets.","triggerScenarios":"Any migration/write path that calls config_toml_without_legacy_antigravity on a config file that contains invalid TOML.","commonSituations":"The config file was hand-edited (or corrupted by a tool) before the cleanup of retired antigravity provider entries runs; upgrade-time migration hitting a pre-existing syntax error.","solutions":["Fix the TOML syntax error in the config file first, then retry the operation","Validate the file with a TOML parser to locate the error","Restore the config from backup or regenerate a default one","Check for a partially-written config file from an earlier crashed write"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let raw = std::fs::read_to_string(&cfg_path)?;\ntoml::from_str::<toml::Value>(&raw).map_err(|e| format!(\"fix TOML first: {e}\"))?;","typeGuard":null,"tryCatchPattern":"match perform_migration() {\n    Ok(_) => {},\n    Err(e) => eprintln!(\"{e}; repair the config TOML then rerun the migration\"),\n}","preventionTips":["Fix pre-existing TOML syntax errors before upgrading/migrating","Keep configs under version control","Validate config after every manual edit"],"tags":["toml","config","migration","parse-error"],"backgroundTag":"schema-validation-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}