nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.98k stars 837 forks source link

fd/rg failed to spawn process #1679

Closed horseinthesky closed 2 years ago

horseinthesky commented 2 years ago

Description

Any attempt to run find_file or live_grep ends with an error.

Neovim version

NVIM v0.7.0-dev+719-gbdfea9d9a
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Ubuntu 20.04

checkhealth telescope

telescope:                                                              
========================================================================
  - ERROR: No healthcheck found for "telescope" plugin.

Steps to reproduce

1) Load my config. 2) Press <leader>ff or press <leader>fg and any letter or digit

Expected behavior

no errors

Actual behavior

Pressing <leader>ff (this is for find_file) ends with:

Neovim: Failed to spawn process: {
  command = "fd",
  pid = "EINVAL: invalid argument",
  stderr = {
    close = <function 1>,
    eof_rx = <function 2>,
    eof_tx = <function 3>,
    read_start = <function 4>,
    start = <function 5>,
    <metatable> = <1>{
      __call = <function 6>,
      __index = <table 1>,
      __tostring = <function 7>,
      new = <function 8>,
      super = <2>{
        __call = <function 6>,
        __index = <table 2>,
        __tostring = <function 7>,
        close = <function 9>,
        new = <function 10>,
        super = <3>{
          __call = <function 6>,
          __index = <table 3>,
          __tostring = <function 7>,
          extend = <function 11>,
          implement = <function 12>,
          is = <function 13>,
          new = <function 14>
        },
        <metatable> = <table 3>
      },
      <metatable> = <table 2>
    }
  },
  stdin = {
    close = <function 15>,
    eof_rx = <function 16>,
    eof_tx = <function 17>,
    read_start = <function 18>,
    start = <function 19>,
    <metatable> = <table 1>
  },
  stdout = {
    eof_rx = <function 20>,
    eof_tx = <function 21>,     
    handle = <userdata 1>,
    <metatable> = <4>{
      __call = <function 6>,
      __index = <table 4>,
      __tostring = <function 7>,
      iter = <function 22>,
      new = <function 23>,
      read = <function 24>,
      super = <table 2>,
      <metatable> = <table 2>
    }
  },
  uv_opts = {
    args = { "--type", "f", "--hidden" },
    stdio = {
      [2] = <userdata 1>
    }
  },
  <metatable> = <5>{
    __index = <table 5>,
    _for_each_pipe = <function 25>,
    close = <function 26>,
    new = <function 27>
  }
}
stack traceback:
        .../site/pack/packer/opt/telescope.nvim/lua/telescope/_.lua:74: in function 'spawn'
        ...cope.nvim/lua/telescope/finders/async_oneshot_finder.lua:46: in function 'finder'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:469: in function <...pack/packer/opt/telescope.nvim/lua/telescope/p
ickers.lua:468>
        [C]: in function 'pcall'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:468: in function <...pack/packer/opt/telescope.nvim/lua/telescope/p
ickers.lua:416>

and

E5108: Error executing lua ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:251: Vim:Error executing lua callback: .../site/pack/packer/opt/telescope.nvim/lua/telescope/_.lua:56: attempt to index field 'handle' (a nil value)
stack traceback:
        .../site/pack/packer/opt/telescope.nvim/lua/telescope/_.lua:56: in function 'close'
        ...cope.nvim/lua/telescope/finders/async_oneshot_finder.lua:28: in function 'close'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:1441: in function '_detach'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:497: in function <...pack/packer/opt/telescope.nvim/lua/telescope/p
ickers.lua:496>
        [C]: in function 'nvim_win_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:251: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function '_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:257: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:236: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'nvim_win_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:251: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function '_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:257: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:236: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Pressing <leader>fg and printing any single letter or digit ends with:

Neovim: Failed to spawn process: {
  command = "rg",
  pid = "EINVAL: invalid argument",
  stderr = {
    close = <function 1>,
    eof_rx = <function 2>,
    eof_tx = <function 3>,
    read_start = <function 4>,
    start = <function 5>,
    <metatable> = <1>{
      __call = <function 6>,
      __index = <table 1>,
      __tostring = <function 7>,
      new = <function 8>,
      super = <2>{
        __call = <function 6>,
        __index = <table 2>,
        __tostring = <function 7>,
        close = <function 9>,
        new = <function 10>,
        super = <3>{
          __call = <function 6>,
          __index = <table 3>,
          __tostring = <function 7>,
          extend = <function 11>,
          implement = <function 12>,
          is = <function 13>,
          new = <function 14>
        },
        <metatable> = <table 3>
      },
      <metatable> = <table 2>
    }
  },
  stdin = {
    close = <function 15>,
    eof_rx = <function 16>,
    eof_tx = <function 17>,
    read_start = <function 18>,
    start = <function 19>,
    <metatable> = <table 1>
  },
  stdout = {
    eof_rx = <function 20>,
    eof_tx = <function 21>,
    handle = <userdata 1>,
    <metatable> = <4>{
      __call = <function 6>,
      __index = <table 4>,
      __tostring = <function 7>,
      iter = <function 22>,
      new = <function 23>,
      read = <function 24>,
      super = <table 2>,
      <metatable> = <table 2>
    }
  },
  uv_opts = {
    args = { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case", "--", "b" },
    cwd = "/home/horseinthesky/ni_api/ni_api",
    stdio = {
      [2] = <userdata 1>
    }
  },
  <metatable> = <5>{
    __index = <table 5>,
    _for_each_pipe = <function 25>,
    close = <function 26>,
    new = <function 27>
  }
}
stack traceback:
        .../site/pack/packer/opt/telescope.nvim/lua/telescope/_.lua:74: in function 'spawn'
        ...elescope.nvim/lua/telescope/finders/async_job_finder.lua:49: in function 'finder'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:469: in function <...pack/packer/opt/telescope.nvim/lua/telescope/p
ickers.lua:468>
        [C]: in function 'pcall'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:468: in function <...pack/packer/opt/telescope.nvim/lua/telescope/p
ickers.lua:416>

and

E5108: Error executing lua ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:251: Vim(lua):E5108: Error executing lua .../site/pack/packer/opt/telescope.nvim/lua/telescope/_.lua:56: attempt to index field 'handle' (a nil value)
stack traceback:
        .../site/pack/packer/opt/telescope.nvim/lua/telescope/_.lua:56: in function 'close'
        ...elescope.nvim/lua/telescope/finders/async_job_finder.lua:70: in function 'close'
        ...pack/packer/opt/telescope.nvim/lua/telescope/pickers.lua:1417: in function 'on_close_prompt'
        [string ":lua"]:1: in main chunk
        [C]: in function 'nvim_win_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:251: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function '_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:257: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:236: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'nvim_win_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:251: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function '_close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:257: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:30: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:236: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

rg and fd are installed, they are in the $PATH and work perfectly fine.

Minimal config

Link to my config https://github.com/horseinthesky/dotfiles/blob/master/files/lua/config/telescope.lua

My config:

local map = require("utils").map

local actions = require "telescope.actions"

require("telescope").setup {
  defaults = {
    mappings = {
      i = {
        ["<esc>"] = actions.close,
        ["<C-J>"] = actions.move_selection_next,
        ["<C-K>"] = actions.move_selection_previous,
      },
    },
    sorting_strategy = "ascending",
    scroll_strategy = "cycle",
    -- layout_strategy = 'vertical',
    prompt_prefix = " ",
    selection_caret = " ",
    layout_config = {
      prompt_position = "top",
      preview_cutoff = 80,
      horizontal = {
        -- width_padding = 10,
        -- height_padding = 7,
        preview_width = 0.6,
      },
    },
    winblend = 10,
  },
}

require("telescope").load_extension "fzf"

-- regular search mappings
map("n", "<leader>ff", [[<cmd>lua require('telescope.builtin').find_files { hidden = true}<CR>]])
map("n", "<leader>fh", [[<cmd>lua require('telescope.builtin').help_tags()<CR>]])
map("n", "<leader>fb", [[<cmd>lua require('telescope.builtin').buffers()<CR>]])
map("n", "<leader>fL", [[<cmd>lua require('telescope.builtin').current_buffer_fuzzy_find()<CR>]])
map("n", "<leader>fB", [[<cmd>lua require('telescope.builtin').builtin({ previewer = false })<CR>]])
map("n", "<leader>fg", [[<cmd>lua require('telescope.builtin').live_grep()<CR>]])
map("n", "<leader>fw", [[<cmd>lua require('telescope.builtin').grep_string { search = vim.fn.expand("<cword>") }<CR>]])
map(
  "n",
  "<leader>fs",
  [[<cmd>lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})<CR>]]
)
map("n", "<leader>fr", [[<cmd>lua require('telescope.builtin').registers()<CR>]])
map("n", "<leader>fm", [[<cmd>lua require('telescope.builtin').marks()<CR>]])
map("n", "<leader>fM", [[<cmd>lua require('telescope.builtin').keymaps()<CR>]])
map("n", "<leader>fo", [[<cmd>lua require('telescope.builtin').vim_options()<CR>]])
map("n", "<leader>fO", [[<cmd>lua require('telescope.builtin').oldfiles()<CR>]])
map("n", "<leader>fc", [[<cmd>lua require('telescope.builtin').commands()<CR>]])
map("n", "<leader>fa", [[<cmd>lua require('telescope.builtin').autocommands()<CR>]])
map("n", "<leader>fH", [[<cmd>lua require('telescope.builtin').highlights()<CR>]])
map("n", "<leader>fC", [[<cmd>lua require('telescope.builtin').colorscheme()<CR>]])
map("n", "<leader>fS", [[<cmd>lua require('telescope.builtin').symbols()<CR>]])

-- git search mappings
map("n", "<leader>gb", [[<cmd>lua require('telescope.builtin').git_branches()<CR>]])
map("n", "<leader>gc", [[<cmd>lua require('telescope.builtin').git_commits()<CR>]])
map("n", "<leader>gs", [[<cmd>lua require('telescope.builtin').git_status()<CR>]])

-- lsp search mappings
map("n", "<leader>fld", [[<cmd>lua require('telescope.builtin').diagnostics( { bufnr = 0 } )<CR>]])
map("n", "<leader>flD", [[<cmd>lua require('telescope.builtin').diagnostics()<CR>]])
map("n", "<leader>fls", [[<cmd>lua require('telescope.builtin').lsp_document_symbols()<CR>]])
map("n", "<leader>flS", [[<cmd>lua require('telescope.builtin').lsp_workspace_symbols()<CR>]])
map("n", "<leader>flr", [[<cmd>lua require('telescope.builtin').lsp_references()<CR>]])

vim.api.nvim_exec(
  [[
    highlight link TelescopeSelection Constant
    highlight link TelescopeSelectionCaret TelescopeSelection
    highlight link TelescopeMultiSelection TelescopeSelection
    highlight link TelescopeMatching Type
    highlight link TelescopePromptPrefix Type
  ]],
  false
)
WilliamMayor commented 2 years ago

I was having this error too. Turns out I didn't RTFM and I needed to install ripgrep before the live_grep feature would work.

https://github.com/BurntSushi/ripgrep

horseinthesky commented 2 years ago

Yeah but as I mentioned

rg and fd are installed, they are in the $PATH and work perfectly fine.
WilliamMayor commented 2 years ago

@horseinthesky Yes, absolutely, sorry, didn't mean to imply that you hadn't RTFM either :) I only wanted to comment because I found this issue by Googling for the error message. I thought it might help other people who found the issue in the same way.

horseinthesky commented 2 years ago

Moved to a new PC. No place to reproduce now.

EmmanuelDodoo commented 1 year ago

Was the solution for this found? I'm running into an identical issue with both fd and rg installed