Hmbown/CodeWhale · error
⚠ tui.toml is malformed — using defaults ({e})
Error message
⚠ tui.toml is malformed — using defaults ({e}) What it means
Same startup fallback as settings.toml but for tui.toml: the file exists yet failed TOML parsing, so TUI-specific configuration is discarded for this session and a ⚠ warning is shown. Launch proceeds with defaults; the corrupt file is not modified or deleted automatically.
Source
Thrown at crates/tui/src/tui/app/init.rs:139
// 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();
// A startup route saved explicitly from `/model` is a user choice and
// must win over a provider merely seeded in config.toml. A one-launch
// CLI/environment provider override still wins so scripts can pin
// their route without changing the user's next interactive launch.
let explicit_launch_provider = crate::config::explicit_launch_provider_override().is_some();
let mut provider_identity_record = config
.active_provider_identity(provider)
.unwrap_or_else(|_| {
let key = config.provider_identity_for(provider);
let exact_id = (!(provider == ApiProvider::CustomView on GitHub (pinned to 0c42157ee5)
Solutions
- Repair the TOML syntax named in the warning message
- Remove or rename the file to start from defaults, then re-add settings incrementally
- Check for schema changes if the file worked under an older version
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/tui/src/tui/app/init.rs:139 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/cc7b7ff5b2b71d22.
Report an issue: GitHub.