kovidgoyal/kitty · error
Failed to parse rg help output line: %s
Error message
Failed to parse rg help output line: %s
What it means
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.
Source
Thrown at kittens/hyperlinked_grep/main.go:61
if options_started {
s := strings.TrimLeft(line, " ")
indent := len(line) - len(s)
if indent < 8 && indent > 0 {
expecting_arg := strings.Contains(s, "=")
single_letter_aliases := make([]string, 0, 1)
long_option_names := make([]string, 0, 1)
for x := range strings.SplitSeq(s, ",") {
x = strings.TrimSpace(x)
if strings.HasPrefix(x, "--") {
lon, _, _ := strings.Cut(x[2:], "=")
long_option_names = append(long_option_names, lon)
} else if strings.HasPrefix(x, "-") {
son, _, _ := strings.Cut(x[1:], " ")
single_letter_aliases = append(single_letter_aliases, son)
}
}
if len(long_option_names) == 0 {
err = fmt.Errorf("Failed to parse rg help output line: %s", line)
return
}
for _, x := range single_letter_aliases {
alias_map[x] = long_option_names[0]
}
for _, x := range long_option_names[1:] {
alias_map[x] = long_option_names[0]
}
expecting_args[long_option_names[0]] = expecting_arg
}
} else {
if strings.HasSuffix(line, "OPTIONS:") {
options_started = true
}
}
}
if len(expecting_args) == 0 || len(alias_map) == 0 {
err = fmt.Errorf("Failed to parse rg help output, could not find any options")View on GitHub (pinned to 6d5d0c4406)
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
Example fix
# before LC_ALL=de_DE.UTF-8 kitty +kitten hyperlinked_grep foo # after LC_ALL=C kitty +kitten hyperlinked_grep foo
Defensive patterns
Strategy: fallback
Validate before calling
if out, err := exec.Command("rg","--help").Output(); err != nil || !bytes.Contains(out, []byte("OPTIONS:")) { /* version mismatch: use plain rg */ } Prevention
- Pin ripgrep and kitty versions together
- Set LC_ALL=C to avoid localized help output
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse rg help output, could not find any options
- Extra characters at end of search
- not a valid file descriptor number: %#v
- %s is not valid MIME alias specification
- Failed to execute rg: %w
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/467354b3297b0bd2.
Report an issue: GitHub.