{"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":null,"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/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/theme.rs#L216-L252","documentation":"ThemePreset implements FromStr accepting only \"dark\" and \"light\" (case-insensitive, trimmed). Any other value — e.g. a `but config theme` value stored or typed incorrectly — produces this error naming the unrecognized preset.","triggerScenarios":"Setting the theme via CLI config or environment to a value other than dark/light, such as `system`, `auto`, `solarized`, or a misspelling.","commonSituations":"Users copying theme names from other tools (VS Code themes); config files migrated from older CLI versions with different preset names; typos like \"daark\".","solutions":["Set the theme to `dark` or `light`, e.g. `but config theme dark`.","Trim whitespace and check spelling if the value comes from a config file.","If you want automatic detection, omit the setting so the terminal colors are detected instead of specifying an unsupported preset."],"exampleFix":"// before\nbut config theme system\n// after\nbut config theme dark","handlingStrategy":"validation","validationCode":"const t = (raw ?? '').trim().toLowerCase();\nif (t !== 'dark' && t !== 'light') throw new Error(`theme must be \"dark\" or \"light\", got \"${raw}\"`);","typeGuard":"function isThemePreset(s) { return ['dark','light'].includes(s.trim().toLowerCase()); }","tryCatchPattern":"match raw.parse::<ThemePreset>() {\n  Ok(p) => apply(p),\n  Err(_) => { eprintln!(\"theme '{raw}' unsupported; using dark\"); apply(ThemePreset::Dark); }\n}","preventionTips":["Only store dark/light in config files and scripts.","Trim and lowercase user input before passing preset values.","Omit the setting to let the CLI auto-detect from terminal colors."],"tags":["cli","configuration","theme","parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}