Hmbown/CodeWhale · error
⚠ settings.toml is malformed — using defaults ({e})
Error message
⚠ settings.toml is malformed — using defaults ({e}) What it means
During TUI initialization, if settings.toml exists on disk but fails TOML parsing, the app falls back to defaults and surfaces this warning in the UI so the user knows their file is broken instead of silently losing all settings. It is a startup-time degradation: the session runs with defaults and the malformed file is left untouched for the user to repair.
Source
Thrown at crates/tui/src/tui/app/init.rs:128
}
}
} else {
false
};
settings.apply_env_overrides();
let launch_visible =
settings.launch_screen && resume_session_id.is_none() && initial_input.is_none();
let launch = LaunchState::new(launch_visible, &workspace);
// If settings.toml exists on disk but couldn't be parsed (we fell back
// to defaults), surface a warning in the TUI so the user knows their
// file is broken instead of silently losing all settings.
let settings_parse_warning = crate::settings::Settings::path().ok().and_then(|p| {
if p.exists() {
std::fs::read_to_string(&p).ok().and_then(|raw| {
::toml::from_str::<::toml::Value>(&raw)
.err()
.map(|e| format!("⚠ settings.toml is malformed — using defaults ({e})"))
})
} else {
None
}
});
let tui_prefs_warning = crate::settings::TuiPrefs::path().ok().and_then(|p| {
if p.exists() {
std::fs::read_to_string(&p).ok().and_then(|raw| {
::toml::from_str::<::toml::Value>(&raw)
.err()
.map(|e| format!("⚠ tui.toml is malformed — using defaults ({e})"))
})
} else {
None
}
});
let mut provider = config.api_provider();View on GitHub (pinned to 0c42157ee5)
Solutions
- Fix the TOML syntax error quoted in the warning (usually a typo or wrong type)
- Back up the file and delete it to regenerate clean defaults
- Compare against the settings schema for renamed or removed keys after upgrades
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/tui/src/tui/app/init.rs:128 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/f67865df7c2f5fa6.
Report an issue: GitHub.