{"record":{"id":"f67865df7c2f5fa6","repo":"Hmbown/CodeWhale","slug":"settings-toml-is-malformed-using-defaults-e","errorCode":null,"errorMessage":"⚠ settings.toml is malformed — using defaults ({e})","messagePattern":"⚠ settings\\.toml is malformed — using defaults \\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/app/init.rs","lineNumber":128,"sourceCode":"                }\n            }\n        } else {\n            false\n        };\n        settings.apply_env_overrides();\n        let launch_visible =\n            settings.launch_screen && resume_session_id.is_none() && initial_input.is_none();\n        let launch = LaunchState::new(launch_visible, &workspace);\n\n        // If settings.toml exists on disk but couldn't be parsed (we fell back\n        // to defaults), surface a warning in the TUI so the user knows their\n        // file is broken instead of silently losing all settings.\n        let settings_parse_warning = crate::settings::Settings::path().ok().and_then(|p| {\n            if p.exists() {\n                std::fs::read_to_string(&p).ok().and_then(|raw| {\n                    ::toml::from_str::<::toml::Value>(&raw)\n                        .err()\n                        .map(|e| format!(\"⚠ settings.toml is malformed — using defaults ({e})\"))\n                })\n            } else {\n                None\n            }\n        });\n        let tui_prefs_warning = crate::settings::TuiPrefs::path().ok().and_then(|p| {\n            if p.exists() {\n                std::fs::read_to_string(&p).ok().and_then(|raw| {\n                    ::toml::from_str::<::toml::Value>(&raw)\n                        .err()\n                        .map(|e| format!(\"⚠ tui.toml is malformed — using defaults ({e})\"))\n                })\n            } else {\n                None\n            }\n        });\n\n        let mut provider = config.api_provider();","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/app/init.rs#L110-L146","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/tui/app/init.rs:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}