{"record":{"id":"d34dbae7fec72c0b","repo":"charmbracelet/glow","slug":"error-parsing-config-v","errorCode":null,"errorMessage":"error parsing config: %v","messagePattern":"error parsing config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":351,"sourceCode":"\tcase tui || cmd.Flags().Changed(\"tui\"):\n\t\tpath := \"\"\n\t\tif !isURL(src.URL) {\n\t\t\tpath = src.URL\n\t\t}\n\t\treturn runTUI(path, content)\n\tdefault:\n\t\tif _, err = fmt.Fprint(w, out); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to write to writer: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n}\n\nfunc runTUI(path string, content string) error {\n\t// Read environment to get debugging stuff\n\tcfg, err := env.ParseAs[ui.Config]()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing config: %v\", err)\n\t}\n\n\t// use style set in env, or auto if unset\n\tif err := validateStyle(cfg.GlamourStyle); err != nil {\n\t\tcfg.GlamourStyle = style\n\t}\n\n\tcfg.Path = path\n\tcfg.ShowAllFiles = showAllFiles\n\tcfg.ShowLineNumbers = showLineNumbers\n\tcfg.GlamourMaxWidth = width\n\tcfg.EnableMouse = mouse\n\tcfg.PreserveNewLines = preserveNewLines\n\n\t// Run Bubble Tea program\n\tif _, err := ui.NewProgram(cfg, content).Run(); err != nil {\n\t\treturn fmt.Errorf(\"unable to run tui program: %w\", err)\n\t}","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/main.go#L333-L369","documentation":"Before starting the TUI, glow parses the environment into ui.Config with caarlos0/env. The struct reads string fields from GOPATH, HOME and GLAMOUR_STYLE plus the bool GLOW_ENABLE_GLAMOUR (default true). This error means one of those variables could not be parsed into its field - practically, GLOW_ENABLE_GLAMOUR set to a value strconv.ParseBool rejects (anything other than 1/t/true/0/f/false, case variants). Note the format uses %v, so the underlying error chain is lost.","triggerScenarios":"export GLOW_ENABLE_GLAMOUR=off/on/yes/no/enabled (invalid bools for ParseBool); values with stray whitespace or newlines; a typo'd variable name pattern that collides with the env tags.","commonSituations":"Users trying to disable glamour with GLOW_ENABLE_GLAMOUR=off instead of =false, dotfiles exporting loose truthy words, wrapper scripts setting boolean-looking env values.","solutions":["Use a strict bool: export GLOW_ENABLE_GLAMOUR=false (or 0)","Or unset the variable to keep the default (true): unset GLOW_ENABLE_GLAMOUR","Check for stray characters: env | grep -i -E 'glow|glamour'"],"exampleFix":"# before\nGLOW_ENABLE_GLAMOUR=off glow\n\n# after\nGLOW_ENABLE_GLAMOUR=false glow","handlingStrategy":"validation","validationCode":"func boolEnvValid(names ...string) error {\n\tfor _, n := range names {\n\t\tif v, ok := os.LookupEnv(n); ok && v != \"\" {\n\t\t\tif _, err := strconv.ParseBool(v); err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s=%q is not a valid bool\", n, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only true/false/1/0 for GLOW_ENABLE_GLAMOUR","Unset env vars rather than setting them to empty strings","Document exact env var spellings in wrapper scripts"],"tags":["config","environment","tui"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}