Hmbown/CodeWhale · error
syntect ships at least one default theme
Error message
syntect ships at least one default theme
What it means
selected_syntax_theme looks up the palette-preferred syntect theme (base16-ocean.dark / InspiredGitHub / Solarized (light)) and falls back to any theme in the default ThemeSet before expecting. It fires only if syntect shipped zero themes — a broken dependency build — because the fallback already absorbs a missing preferred theme name.
Source
Thrown at crates/tui/src/tui/markdown_render.rs:1122
"yml" => "yaml",
"md" => "markdown",
other => other,
};
Some(normalized.to_string())
}
fn selected_syntax_theme(mode: palette::PaletteMode) -> &'static Theme {
let themes = theme_set();
let preferred = match mode {
palette::PaletteMode::Dark | palette::PaletteMode::Grayscale => "base16-ocean.dark",
palette::PaletteMode::Light => "InspiredGitHub",
palette::PaletteMode::SolarizedLight => "Solarized (light)",
};
themes
.themes
.get(preferred)
.or_else(|| themes.themes.values().next())
.expect("syntect ships at least one default theme")
}
fn syntax_style_to_ratatui(
style: syntect::highlighting::Style,
base_style: Style,
palette_mode: palette::PaletteMode,
) -> Style {
let fg = syntax_rgb_to_terminal_color(
style.foreground.r,
style.foreground.g,
style.foreground.b,
palette_mode,
syntax_color_depth(),
);
let mut modifiers = Modifier::empty();
if style.font_style.contains(FontStyle::BOLD) {
modifiers |= Modifier::BOLD;
}View on GitHub (pinned to 0c42157ee5)
Solutions
- Rely on the .or_else(values().next()) fallback for renamed or missing preferred themes
- If a preferred theme is removed upstream, update the palette match arms
- Verify themes.themes is non-empty at startup if a stripped-down theme set is ever embedded
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/tui/src/tui/markdown_render.rs:1122 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/6b342396d348a89d.
Report an issue: GitHub.