{"record":{"id":"6b342396d348a89d","repo":"Hmbown/CodeWhale","slug":"syntect-ships-at-least-one-default-theme","errorCode":null,"errorMessage":"syntect ships at least one default theme","messagePattern":"syntect ships at least one default theme","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/markdown_render.rs","lineNumber":1122,"sourceCode":"        \"yml\" => \"yaml\",\n        \"md\" => \"markdown\",\n        other => other,\n    };\n    Some(normalized.to_string())\n}\n\nfn selected_syntax_theme(mode: palette::PaletteMode) -> &'static Theme {\n    let themes = theme_set();\n    let preferred = match mode {\n        palette::PaletteMode::Dark | palette::PaletteMode::Grayscale => \"base16-ocean.dark\",\n        palette::PaletteMode::Light => \"InspiredGitHub\",\n        palette::PaletteMode::SolarizedLight => \"Solarized (light)\",\n    };\n    themes\n        .themes\n        .get(preferred)\n        .or_else(|| themes.themes.values().next())\n        .expect(\"syntect ships at least one default theme\")\n}\n\nfn syntax_style_to_ratatui(\n    style: syntect::highlighting::Style,\n    base_style: Style,\n    palette_mode: palette::PaletteMode,\n) -> Style {\n    let fg = syntax_rgb_to_terminal_color(\n        style.foreground.r,\n        style.foreground.g,\n        style.foreground.b,\n        palette_mode,\n        syntax_color_depth(),\n    );\n    let mut modifiers = Modifier::empty();\n    if style.font_style.contains(FontStyle::BOLD) {\n        modifiers |= Modifier::BOLD;\n    }","sourceCodeStart":1104,"sourceCodeEnd":1140,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/markdown_render.rs#L1104-L1140","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/tui/markdown_render.rs:1122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"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-14T00:17:10.932Z"}