{"record":{"id":"bc1db562ef762722","repo":"kovidgoyal/kitty","slug":"failed-to-execute-rg-w","errorCode":null,"errorMessage":"Failed to execute rg: %w","messagePattern":"Failed to execute rg: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/hyperlinked_grep/main.go","lineNumber":34,"sourceCode":"\t\"unicode\"\n\n\t\"github.com/kovidgoyal/kitty/tools/cli\"\n\t\"github.com/kovidgoyal/kitty/tools/utils\"\n\n\t\"golang.org/x/sys/unix\"\n)\n\nvar _ = fmt.Print\n\nvar RgExe = sync.OnceValue(func() string {\n\treturn utils.FindExe(\"rg\")\n})\n\nfunc get_options_for_rg() (expecting_args map[string]bool, alias_map map[string]string, err error) {\n\tvar raw []byte\n\traw, err = exec.Command(RgExe(), \"--help\").Output()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to execute rg: %w\", err)\n\t\treturn\n\t}\n\tscanner := utils.NewLineScanner(utils.UnsafeBytesToString(raw))\n\toptions_started := false\n\texpecting_args = make(map[string]bool, 64)\n\talias_map = make(map[string]string, 52)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\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, \"--\") {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/hyperlinked_grep/main.go#L16-L52","documentation":"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().","triggerScenarios":"ripgrep not installed or not on PATH, RgExe() pointing to a broken path, or rg crashing on startup.","commonSituations":"System without ripgrep installed; PATH stripped when running kitty kitten from a launcher/service; incompatible rg version that exits on --help.","solutions":["Install ripgrep (e.g. apt install ripgrep / brew install ripgrep) and verify `rg --help` works in the same environment","Ensure PATH includes the rg binary when launching kitty","Check RgExe() resolution / bundled rg if kitty expects one"],"exampleFix":"# before: rg missing\n$ kitty +kitten hyperlinked_grep pattern\n# after\n$ sudo apt install ripgrep\n$ kitty +kitten hyperlinked_grep pattern","handlingStrategy":"fallback","validationCode":"if _, err := exec.LookPath(\"rg\"); err != nil { /* install rg or disable kitten */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install ripgrep before using hyperlinked_grep","Keep PATH stable in launchers that spawn kitty kittens"],"tags":["kitty","ripgrep","subprocess","path"],"backgroundTag":"command-not-found","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}