{"record":{"id":"467354b3297b0bd2","repo":"kovidgoyal/kitty","slug":"failed-to-parse-rg-help-output-line-s","errorCode":null,"errorMessage":"Failed to parse rg help output line: %s","messagePattern":"Failed to parse rg help output line: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/hyperlinked_grep/main.go","lineNumber":61,"sourceCode":"\t\tif options_started {\n\t\t\ts := strings.TrimLeft(line, \" \")\n\t\t\tindent := len(line) - len(s)\n\t\t\tif indent < 8 && indent > 0 {\n\t\t\t\texpecting_arg := strings.Contains(s, \"=\")\n\t\t\t\tsingle_letter_aliases := make([]string, 0, 1)\n\t\t\t\tlong_option_names := make([]string, 0, 1)\n\t\t\t\tfor x := range strings.SplitSeq(s, \",\") {\n\t\t\t\t\tx = strings.TrimSpace(x)\n\t\t\t\t\tif strings.HasPrefix(x, \"--\") {\n\t\t\t\t\t\tlon, _, _ := strings.Cut(x[2:], \"=\")\n\t\t\t\t\t\tlong_option_names = append(long_option_names, lon)\n\t\t\t\t\t} else if strings.HasPrefix(x, \"-\") {\n\t\t\t\t\t\tson, _, _ := strings.Cut(x[1:], \" \")\n\t\t\t\t\t\tsingle_letter_aliases = append(single_letter_aliases, son)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(long_option_names) == 0 {\n\t\t\t\t\terr = fmt.Errorf(\"Failed to parse rg help output line: %s\", line)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor _, x := range single_letter_aliases {\n\t\t\t\t\talias_map[x] = long_option_names[0]\n\t\t\t\t}\n\t\t\t\tfor _, x := range long_option_names[1:] {\n\t\t\t\t\talias_map[x] = long_option_names[0]\n\t\t\t\t}\n\t\t\t\texpecting_args[long_option_names[0]] = expecting_arg\n\t\t\t}\n\t\t} else {\n\t\t\tif strings.HasSuffix(line, \"OPTIONS:\") {\n\t\t\t\toptions_started = true\n\t\t\t}\n\t\t}\n\t}\n\tif len(expecting_args) == 0 || len(alias_map) == 0 {\n\t\terr = fmt.Errorf(\"Failed to parse rg help output, could not find any options\")","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/hyperlinked_grep/main.go#L43-L79","documentation":"While parsing `rg --help` output, a line in the OPTIONS section looked like an option line but no long option name (like --text) could be extracted from it. The parser found flags/aliases but zero long names on that line.","triggerScenarios":"A ripgrep version whose --help formatting differs from what the parser expects (changed indentation, wrapped lines, or new option syntax), causing a line to match the option-line heuristic without yielding a long name.","commonSituations":"Upgrading ripgrep to a version with reformatted help text; locale set so help output is translated; rg replaced by a wrapper/alias printing extra lines.","solutions":["Pin/use a ripgrep version known to work with your kitty version (update kitty to match your rg)","Set LC_ALL=C so rg help output is not localized","If wrapping rg in a script, ensure passthrough of unmodified --help output"],"exampleFix":"# before\nLC_ALL=de_DE.UTF-8 kitty +kitten hyperlinked_grep foo\n# after\nLC_ALL=C kitty +kitten hyperlinked_grep foo","handlingStrategy":"fallback","validationCode":"if out, err := exec.Command(\"rg\",\"--help\").Output(); err != nil || !bytes.Contains(out, []byte(\"OPTIONS:\")) { /* version mismatch: use plain rg */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin ripgrep and kitty versions together","Set LC_ALL=C to avoid localized help output"],"tags":["kitty","ripgrep","parsing","version-compat"],"backgroundTag":"help-output-parse-failure","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}