{"record":{"id":"16fa1ce0d02c0a0a","repo":"gitbutlerapp/gitbutler","slug":"unknown-theme-preset-unknown","errorCode":null,"errorMessage":"Unknown theme preset: {unknown}","messagePattern":"Unknown theme preset: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/theme.rs","lineNumber":234,"sourceCode":"\n/// Identifiers for the theme presets.\n#[derive(Debug, PartialEq, Eq, Clone)]\npub enum ThemePreset {\n    /// The dark preset.\n    Dark,\n    /// The light preset.\n    Light,\n}\n\nimpl FromStr for ThemePreset {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        let normalized = s.to_lowercase();\n        match normalized.trim() {\n            \"dark\" => Ok(ThemePreset::Dark),\n            \"light\" => Ok(ThemePreset::Light),\n            unknown => Err(anyhow::anyhow!(\"Unknown theme preset: {unknown}\")),\n        }\n    }\n}\n\n/// Detect the theme preset from the terminal's foreground and background colors.\n///\n/// Returns `None` if the terminal does not support color queries or does not respond in time.\npub(crate) fn detect_terminal_preset() -> Option<ThemePreset> {\n    terminal_colorsaurus::theme_mode(terminal_colorsaurus::QueryOptions::default())\n        .ok()\n        .map(theme_preset_from_terminal_mode)\n}\n\nfn theme_preset_from_terminal_mode(mode: terminal_colorsaurus::ThemeMode) -> ThemePreset {\n    match mode {\n        terminal_colorsaurus::ThemeMode::Dark => ThemePreset::Dark,\n        terminal_colorsaurus::ThemeMode::Light => ThemePreset::Light,\n    }","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/theme.rs#L216-L252","documentation":"ThemePreset::from_str normalizes case and surrounding whitespace but accepts only the exact values 'dark' and 'light'. Any other string supplied via theme config or a CLI flag fails this parse error.","triggerScenarios":"Setting the theme preset to anything other than dark/light, such as 'auto', 'system', 'terminal', or 'high-contrast', in the config file or on the command line.","commonSituations":"Users expecting 'auto'/'system' to trigger terminal color detection; configs copied from other tools with different vocabulary; stray whitespace or quotes around the value.","solutions":["Use 'dark' or 'light' (case-insensitive)","Omit the setting so but falls back to detecting the terminal theme (detect_terminal_preset)","Check the config file for typos, quotes, or trailing whitespace around the value"],"exampleFix":"# before\ntheme = \"auto\"   # not a valid preset\n# after\ntheme = \"dark\"   # or \"light\", or remove the key for auto-detection","handlingStrategy":"validation","validationCode":"fn is_theme_preset(s: &str) -> bool {\n    matches!(s.trim().to_lowercase().as_str(), \"dark\" | \"light\")\n}","typeGuard":"fn theme_preset_or_none(s: &str) -> Option<ThemePreset> {\n    match s.trim().to_lowercase().as_str() {\n        \"dark\" => Some(ThemePreset::Dark),\n        \"light\" => Some(ThemePreset::Light),\n        _ => None,\n    }\n}","tryCatchPattern":null,"preventionTips":["Validate theme values against the enum before writing config","Fall back to detect_terminal_preset() on unknown values instead of failing"],"tags":["theme","config","value-validation","cli"],"backgroundTag":"invalid-config-value","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}