Hmbown/CodeWhale · error
failed to parse config TOML while clearing retired provider…
Error message
failed to parse config TOML while clearing retired provider state; file contents were omitted
What it means
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.
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
Defensive patterns
Strategy: validation
Validate before calling
let raw = std::fs::read_to_string(&cfg_path)?;
toml::from_str::<toml::Value>(&raw).map_err(|e| format!("fix TOML first: {e}"))?; Try / catch
match perform_migration() {
Ok(_) => {},
Err(e) => eprintln!("{e}; repair the config TOML then rerun the migration"),
} Prevention
- Fix pre-existing TOML syntax errors before upgrading/migrating
- Keep configs under version control
- Validate config after every manual edit
When it happens
Trigger: Any migration/write path that calls config_toml_without_legacy_antigravity on a config file that contains invalid TOML.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Could not parse configuration for route preference…
- Could not parse destination route identity; contents omitted
- failed to parse config at
- failed to parse config at
- failed to parse config at
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/f283aa777590062e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/config/src/lib.rs:5504
format!(
"failed to clear retired provider state from config backup {}",
backup.display()
)
})?;
if scrubbed != raw {
persistence::atomic_write(&backup, scrubbed.as_bytes()).with_context(|| {
format!(
"failed to write retired-provider-free config backup {}",
backup.display()
)
})?;
}
Ok(())
}
fn config_toml_without_legacy_antigravity(raw: &str) -> Result<String> {
let mut document = raw.parse::<toml_edit::DocumentMut>().map_err(|_| {
anyhow::anyhow!(
"failed to parse config TOML while clearing retired provider state; file contents were omitted"
)
})?;
let root = document.as_table_mut();
if root
.get("provider")
.and_then(toml_edit::Item::as_str)
.is_some_and(is_legacy_antigravity_name)
{
root.remove("provider");
}
if let Some(fallbacks) = root
.get_mut("fallback_providers")
.and_then(toml_edit::Item::as_array_mut)
{
fallbacks.retain(|value| !value.as_str().is_some_and(is_legacy_antigravity_name));
if fallbacks.is_empty() {View on GitHub (pinned to 73e0f67d83)