kovidgoyal/kitty · error

Failed to execute rg: %w

Error message

Failed to execute rg: %w

What it means

hyperlinked_grep kitten shells out to `rg --help` to discover ripgrep's option list; the exec failed (binary missing, not executable, or the command errored). The resolved rg path comes from RgExe().

Source

Thrown at kittens/hyperlinked_grep/main.go:34

	"unicode"

	"github.com/kovidgoyal/kitty/tools/cli"
	"github.com/kovidgoyal/kitty/tools/utils"

	"golang.org/x/sys/unix"
)

var _ = fmt.Print

var RgExe = sync.OnceValue(func() string {
	return utils.FindExe("rg")
})

func get_options_for_rg() (expecting_args map[string]bool, alias_map map[string]string, err error) {
	var raw []byte
	raw, err = exec.Command(RgExe(), "--help").Output()
	if err != nil {
		err = fmt.Errorf("Failed to execute rg: %w", err)
		return
	}
	scanner := utils.NewLineScanner(utils.UnsafeBytesToString(raw))
	options_started := false
	expecting_args = make(map[string]bool, 64)
	alias_map = make(map[string]string, 52)
	for scanner.Scan() {
		line := scanner.Text()
		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, "--") {

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Install ripgrep (e.g. apt install ripgrep / brew install ripgrep) and verify `rg --help` works in the same environment
  2. Ensure PATH includes the rg binary when launching kitty
  3. Check RgExe() resolution / bundled rg if kitty expects one

Example fix

# before: rg missing
$ kitty +kitten hyperlinked_grep pattern
# after
$ sudo apt install ripgrep
$ kitty +kitten hyperlinked_grep pattern
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := exec.LookPath("rg"); err != nil { /* install rg or disable kitten */ }

Prevention

When it happens

Trigger: ripgrep not installed or not on PATH, RgExe() pointing to a broken path, or rg crashing on startup.

Common situations: System without ripgrep installed; PATH stripped when running kitty kitten from a launcher/service; incompatible rg version that exits on --help.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/bc1db562ef762722. Report an issue: GitHub.