Hmbown/CodeWhale · warning

⚠ configured theme ' ' could not be loaded — using System (…

Error message

⚠ configured theme '{}' could not be loaded — using System ({error})

What it means

During TUI init, the theme name from settings is resolved via palette::resolve_theme_setting. If resolution fails (unknown theme name, unparseable custom color), the app logs this warning and falls back to the System theme instead of crashing.

Solutions

  1. Check the theme value in settings.toml against the available theme names in palette::ThemeId (e.g. System, Dark, Light) and correct the typo
  2. Remove or fix the custom background hex color value if the error mentions the color
  3. Reset to the default by deleting/commenting the `theme` key, letting the app use System, then choose a valid theme from within the TUI

Example fix

# before
theme = "gruvox-dark"
# after
theme = "Dark"
Defensive patterns

Strategy: validation

Validate before calling

// before putting a theme in settings.toml
let valid = ["System", "Dark", "Light"]; // per palette::ThemeId
let theme = std::env::var("THEME").unwrap_or_default();
if !valid.contains(&theme.as_str()) {
    eprintln!("unknown theme '{theme}'; valid: {valid:?}");
}

Prevention

When it happens

Trigger: settings.theme names a theme not in the registry, or resolve_theme_setting fails parsing the custom background hex color (paired background_setting), producing an Err.

Common situations: Typo in theme name in settings.toml; theme renamed across versions; invalid hex color string for a background override; config copied from another machine with a theme that isn't installed.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/42205a88196e5de9. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tui/app/init.rs:336

        let transcript_spacing = TranscriptSpacing::from_setting(&settings.transcript_spacing);
        let max_input_history = settings.max_input_history;
        // Requesting bracketed paste does not prove the terminal delivers it.
        // Keep the fallback until handle_paste_burst_key observes a real paste
        // via bracketed_paste_seen; otherwise raw pasted newlines can submit.
        let use_paste_burst_detection = settings.paste_burst_detection;
        // Resolve the named theme from settings; unknown values were already
        // normalised to the underwater default in Settings::load. The
        // background_color setting still overlays on top.
        let background_color_override = settings
            .background_color
            .as_deref()
            .and_then(palette::parse_hex_rgb_color);
        let background_setting = background_color_override.and_then(palette::hex_rgb_string);
        let resolved_theme =
            palette::resolve_theme_setting(&settings.theme, background_setting.as_deref());
        let theme_warning = resolved_theme.as_ref().err().map(|error| {
            format!(
                "⚠ configured theme '{}' could not be loaded — using System ({error})",
                settings.theme
            )
        });
        let (theme_name, theme_id, ui_theme) = resolved_theme.unwrap_or_else(|_| {
            let id = palette::ThemeId::System;
            let mut theme = id.ui_theme();
            if let Some(background) = background_color_override {
                theme = theme.with_background_color(background);
            }
            (id.name().to_string(), id, theme)
        });
        // Remembered route choices were resolved once into Config. The
        // chooser and hotbar must not revive archived Settings values.
        let mut provider_models = HashMap::new();
        for &candidate in ApiProvider::all() {
            if candidate != ApiProvider::Custom
                && let Some(model) = config
                    .provider_config_for(candidate)

View on GitHub (pinned to 73e0f67d83)