{"record":{"id":"755b37301a69e632","repo":"charmbracelet/glow","slug":"specified-style-does-not-exist-s","errorCode":null,"errorMessage":"specified style does not exist: %s","messagePattern":"specified style does not exist: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":158,"sourceCode":"\n\tr, err := os.Open(arg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open file: %w\", err)\n\t}\n\tu, err := filepath.Abs(arg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get absolute path: %w\", err)\n\t}\n\treturn &source{r, u}, nil\n}\n\n// validateStyle checks if the style is a default style, if not, checks that\n// the custom style exists.\nfunc validateStyle(style string) error {\n\tif style != \"auto\" && styles.DefaultStyles[style] == nil {\n\t\tstyle = utils.ExpandPath(style)\n\t\tif _, err := os.Stat(style); errors.Is(err, fs.ErrNotExist) {\n\t\t\treturn fmt.Errorf(\"specified style does not exist: %s\", style)\n\t\t} else if err != nil {\n\t\t\treturn fmt.Errorf(\"unable to stat file: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateOptions(cmd *cobra.Command) error {\n\t// grab config values from Viper\n\twidth = viper.GetUint(\"width\")\n\tmouse = viper.GetBool(\"mouse\")\n\tpager = viper.GetBool(\"pager\")\n\ttui = viper.GetBool(\"tui\")\n\tshowAllFiles = viper.GetBool(\"all\")\n\tpreserveNewLines = viper.GetBool(\"preserveNewLines\")\n\tshowLineNumbers = viper.GetBool(\"showLineNumbers\")\n\n\tif pager && tui {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/main.go#L140-L176","documentation":"validateStyle runs when the requested style is not \"auto\" and not one of the built-in styles in styles.DefaultStyles. It expands the value with utils.ExpandPath (tilde expansion) and stats it; if stat returns fs.ErrNotExist, glow reports that the style does not exist. So this fires for a mistyped built-in style name or a custom style JSON path that is not present on disk.","triggerScenarios":"glow -s mystyle.json with a typo'd or moved file; misspelling a built-in style name (e.g. dracul instead of dracula); HOME changed so ~ expands elsewhere; relative style path resolved from the wrong working directory.","commonSituations":"Typos in style names in scripts and CI, custom style files moved or deleted after config was written, HOME differing between environments (sudo, systemd) so tilde expansion lands somewhere else.","solutions":["Check the spelling against the built-in style names glow/glamour ship (dark, light, notty, ...)","For a custom style, verify the file exists: ls -l <stylepath> before running","If using ~, confirm HOME points where you expect: echo $HOME","Run from the directory containing the style file, or use an absolute path"],"exampleFix":"// before\nglow -s dracul README.md   # typo: built-in style is 'dracula'\n\n// after\nglow -s dracula README.md\n// or point at an existing custom style file:\nglow -s /home/me/styles/dracula.json README.md","handlingStrategy":"validation","validationCode":"func styleUsable(style string) bool {\n\tif style == \"auto\" || styles.DefaultStyles[style] != nil { return true }\n\t_, err := os.Stat(utils.ExpandPath(style))\n\treturn err == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the style against DefaultStyles and stat the file before launching glow","Keep custom styles in a fixed directory and reference them by absolute path","Test style paths in CI whenever scripts ship them"],"tags":["style","config","filesystem","cli-input"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}