{"record":{"id":"89e5c4d26fd2f11e","repo":"sqshq/sampler","slug":"specified-theme-is-not-supported-v","errorCode":null,"errorMessage":"Specified theme is not supported: %v","messagePattern":"Specified theme is not supported: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"console/palette.go","lineNumber":70,"sourceCode":"\tswitch theme {\n\tcase ThemeDark:\n\t\treturn Palette{\n\t\t\tContentColors:  []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorWhite, ColorGrey, ColorGreen, ColorOrange, ColorCian, ColorPurple},\n\t\t\tGradientColors: [][]ui.Color{{39, 33, 62, 93, 164, 161}, {95, 138, 180, 179, 178, 178}},\n\t\t\tBaseColor:      ColorWhite,\n\t\t\tMediumColor:    ColorDarkGrey,\n\t\t\tReverseColor:   ColorBlack,\n\t\t}\n\tcase ThemeLight:\n\t\treturn Palette{\n\t\t\tContentColors:  []ui.Color{ColorBlack, ColorDarkRed, ColorBlueViolet, ColorGrey, ColorGreen},\n\t\t\tGradientColors: [][]ui.Color{{250, 248, 246, 244, 242, 240, 238, 236, 234, 232, 16}},\n\t\t\tBaseColor:      ColorBlack,\n\t\t\tMediumColor:    ColorLightGrey,\n\t\t\tReverseColor:   ColorWhite,\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Specified theme is not supported: %v\", theme))\n\t}\n}\n\n// GetMenuColor returns a color based on the\n// operating system target\nfunc GetMenuColor() ui.Color {\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\treturn menuColorWindows\n\tdefault:\n\t\treturn menuColorNix\n\t}\n}\n\n// GetMenuColorReverse returns a color based on the\n// operating system target\nfunc GetMenuColorReverse() ui.Color {\n\tswitch runtime.GOOS {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/sqshq/sampler/blob/9bc7ba732d31f32a917ad4b5605f00b76ebe0891/console/palette.go#L52-L88","documentation":"GetPalette switches on the Theme enum and panics in the default branch when the theme value is not one of the supported constants (e.g. ThemeDark/ThemeLight). Since Theme is parsed from the YAML as a string, an unrecognized theme name produces this panic at startup.","triggerScenarios":"Passing a console.Theme value outside the supported set to GetPalette — typically from a config file with theme: <unknown string>, or constructing Theme from raw YAML bytes without prior validation.","commonSituations":"Typo in the YAML theme key (e.g. \"darck\", \"dark \"); config from an older/newer version with a renamed theme; programmatically casting an arbitrary string to console.Theme.","solutions":["Set theme to a supported value (dark or light) in the config","Validate the theme string against known values during config load and fall back to defaultTheme on mismatch","Handle the panic with recover if themes should be non-fatal, or add a validation step in config parsing","Check the Theme type's constants for the exact accepted names"],"exampleFix":"// before\ntheme: darck\n// after\ntheme: dark","handlingStrategy":"validation","validationCode":"switch cfg.Theme {\ncase \"\", \"dark\", \"light\":\ndefault:\n    log.Printf(\"unknown theme %q, using dark\", cfg.Theme)\n    cfg.Theme = \"dark\"\n}","typeGuard":"func validTheme(t console.Theme) bool { return t == console.ThemeDark || t == console.ThemeLight }","tryCatchPattern":"func paletteSafe(theme console.Theme) (p console.Palette, err error) {\n    defer func() { if r := recover(); r != nil { err = fmt.Errorf(\"bad theme: %v\", r) } }()\n    return console.GetPalette(theme), nil\n}","preventionTips":["Validate theme strings at config parse time against the Theme enum","Use the default theme when the field is absent or unknown","Keep theme names documented next to the config sample"],"tags":["go","panic","theme","invalid-enum","config"],"backgroundTag":"invalid-enum-value","analyzedSha":"9bc7ba732d31f32a917ad4b5605f00b76ebe0891","analyzedAt":"2026-09-06T08:38:02.595Z","contentChangedAt":"2026-09-06T08:38:02.595Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}