packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

"Error executing luv callback:", bad argument #1

Open garymh opened this issue 3 years ago • 14 comments

Hi! I'm getting the following error message using packer with nightly neovim:

Error executing luv callback: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:76: bad argument #1 to 'is_active' (Expected uv_handle userdata)

This happens when trying to use PackerInstall or PackerSync- a large majority of the packages will update fine, but 7 or 8 seem to freeze on the "Cloning..." part of the update. After a minute or two, the above error message shows up.

Here is my plugins.lua:

vim.cmd [[packadd packer.nvim]]

function has_tmux()
  return os.getenv('TMUX') == true
end

return require('packer').startup(function()
  -- Packer can manage itself as an optional plugin
  use {'wbthomason/packer.nvim', opt = true}
  use {'norcalli/nvim_utils'}

  ruby_filetypes = {'ruby', 'eruby', 'slim', 'haml', 'rspec'}
  use {'ngmy/vim-rubocop',  ft = ruby_filetypes}
  use {'tpope/vim-endwise', ft = ruby_filetypes}

  use {'christoomey/vim-tmux-navigator',     cond = has_tmux()}
  use {'benmills/vimux',                     cond = has_tmux()}
  use {'tmux-plugins/vim-tmux-focus-events', cond = has_tmux()}

  use {'AndrewRadev/undoquit.vim',    opt = true, cmd = {'Undoquit'}}
  use {'mhinz/vim-sayonara',          opt = true, cmd = {'Sayonara'}}
  use {'AndrewRadev/splitjoin.vim',   opt = true, cmd = {'SplitjoinSplit', 'SplitjoinJoin'}}
  use {'AndrewRadev/multichange.vim', opt = true, cmd = {'Multichange'}}
  use {'foosoft/vim-argwrap',         opt = true, cmd = {'ArgWrap'}}
  use {'AndrewRadev/deleft.vim',      opt = true, cmd = {'Deleft'}}
  use {'liuchengxu/vista.vim',        opt = true, cmd = {'Vista'}}
  use {'eugen0329/vim-esearch',       opt = true, key = {'n', '<Plug>(esearch)'}}
  use {'junegunn/vim-easy-align'}
  use {'AndrewRadev/sideways.vim'}
  use {'AndrewRadev/switch.vim'}
  use {'rhysd/git-messenger.vim'}
  use {
    'nvim-telescope/telescope.nvim',
    requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}
  }
  use {'https://gitlab.com/alexkalderimis/deoplete-gitlab', run = './bin/install.sh' }
  use {'ripxorip/aerojump.nvim', run = ':UpdateRemotePlugins' }
  use {'AndrewRadev/dsf.vim'}
  use {'AndrewRadev/rails_extra.vim'}
  use {'Shougo/echodoc.vim'}
  use {'airblade/vim-gitgutter'}
  use {'airblade/vim-rooter'}
  use {'christoomey/vim-sort-motion'}
  use {'dkarter/bullets.vim'}
  use {'dstein64/vim-startuptime'}
  use {'duggiefresh/vim-easydir'}
  use {'editorconfig/editorconfig-vim'}
  use {'farmergreg/vim-lastplace'}
  use {'google/vim-searchindex'}
  use {'honza/vim-snippets'}
  use {'janko-m/vim-test'}
  use {'jkramer/vim-checkbox'}
  use {'justinmk/vim-gtfo'}
  use {'kana/vim-niceblock'}
  use {'kristijanhusak/vim-dadbod-completion'}
  use {'kshenoy/vim-signature'}
  use {'liuchengxu/vim-which-key'}
  use {'machakann/vim-sandwich'}
  use {'pechorin/any-jump.vim'}
  use {'pgdouyon/vim-evanesco'}
  use {'sheerun/vim-polyglot'}
  use {'shumphrey/fugitive-gitlab.vim'}
  use {'sickill/vim-pasta'}
  use {'takac/vim-commandcaps'}
  use {'tpope/vim-abolish'}
  use {'tpope/vim-apathy'}
  use {'tpope/vim-commentary'}
  use {'tpope/vim-dadbod'}
  use {'tpope/vim-eunuch'}
  use {'tpope/vim-fugitive'}
  use {'tpope/vim-projectionist'}
  use {'tpope/vim-repeat'}
  use {'tpope/vim-rsi'}
  use {'tpope/vim-unimpaired'}
  use {'wellle/targets.vim'}
  use {'wincent/terminus'}
  use {'wsdjeg/vim-fetch'}
  use {'ntpeters/vim-better-whitespace'}
  use {'kyazdani42/blue-moon'}
  use {'kyazdani42/nvim-web-devicons'}
  use {'luochen1990/rainbow'}
  use {'nanotech/jellybeans.vim'}
  use {'eemed/sitruuna.vim'}
  use {'voldikss/vim-floaterm'}
  use {'pgavlin/pulumi.vim'}
  use {'romgrk/barbar.nvim'}
  use {'yuntan/neovim-indent-guides'}
  use {'wadackel/vim-dogrun'}
  use {'tjdevries/colorbuddy.nvim'}
  use {'ryanoasis/vim-devicons'}
  use {'romgrk/doom-one.vim'}
  use {'camspiers/animate.vim'}
  use {'camspiers/lens.vim'}
  use {'norcalli/nvim-colorizer.lua'}
  use {'ojroques/vim-scrollstatus'}
end)

Misc info: NVIM v0.5.0-dev+941-g9c56d8e5f Build type: Release LuaJIT 2.1.0-beta3 macOS 11.0.1

garymh avatar Dec 13 '20 04:12 garymh

Hmm, interesting. Could you please post your git version as well?

Is it always the same few plugins that fail? If so, which?

Your config looks fine, so I'm suspecting either a weird git issue or a slow network is exposing an issue in the jobs module. Specifically, it looks like the timeout condition is being triggered, but after the job handle is no longer valid?

Also, irrelevant to the problem here: you don't need to manually specify opt for the plugins you lazy-load with cmd or keys; it's implied. You also don't need to use curly braces for the calls with only a single plugin (which imho makes things look nicer, but is a purely aesthetic difference).

wbthomason avatar Dec 14 '20 05:12 wbthomason

Sure: git version 2.29.2

Interestingly it does seem to be some of the same plugins every time!

⟳ AndrewRadev/deleft.vim: cloning...
⟳ AndrewRadev/rails_extra.vim: cloning...
⟳ adriaanzon/vim-textobj-matchit: cloning...
⟳ airblade/vim-gitgutter: cloning...
⟳ benmills/vimux: cloning...
⟳ christoomey/vim-sort-motion: cloning...
⟳ dstein64/vim-startuptime: cloning...
⟳ eugen0329/vim-esearch: cloning...
⟳ honza/vim-snippets: cloning...
⟳ janko-m/vim-test: cloning...
⟳ junegunn/vim-easy-align: cloning...
⟳ justinmk/vim-gtfo: cloning...
⟳ kana/vim-textobj-line: cloning...
⟳ ngmy/vim-rubocop: cloning...
⟳ nvim-lua/completion-nvim: cloning...
⟳ nvim-lua/plenary.nvim: cloning...
⟳ nvim-telescope/telescope-fzy-native.nvim: cloning...
⟳ nvim-telescope/telescope-packer.nvim: cloning...
⟳ nvim-telescope/telescope.nvim: cloning...
⟳ nvim-treesitter/nvim-treesitter-textobjects: cloning...
⟳ nvim-treesitter/nvim-treesitter: cloning...
⟳ ojroques/vim-scrollstatus: cloning...
⟳ rhysd/git-messenger.vim: cloning...
⟳ ripxorip/aerojump.nvim: cloning...
⟳ sheerun/vim-polyglot: cloning...
⟳ takac/vim-commandcaps: cloning...
⟳ tpope/vim-commentary: cloning...
⟳ wadackel/vim-dogrun: cloning...
⟳ yuntan/neovim-indent-guides: cloning...

Although I'm not sure if its something specific to those repos. Just running PackerInstall will install them.

🤔 It does seem like git is getting overloaded somehow.

Ah! Thanks for the Lua tip 😄

garymh avatar Dec 15 '20 03:12 garymh

Fascinating. I have the same git version and cannot reproduce the issue, so I think that theory may be (mostly) dead.

What I did notice when trying to PackerInstall with your config was the following:

  1. Just cloning all of the plugins takes a long time. If you have a poor internet connection, you could easily be running into a timeout issue. packer should still be handling this more gracefully than it is, so there's still a bug, but your problem can maybe be resolved by tweaking the value of git.clone_timeout in the config.
  2. Installing the deoplete-gitlab plugin caused an unexpected password prompt, which could maybe be hanging and blocking progress?

wbthomason avatar Dec 15 '20 05:12 wbthomason

(sorry about the late reply!) My internet connection is pretty good and just removing the deoplete-gitlab plugin didn't seem to help. I also adjusted the git.clone_timeout which didn't seem to do the trick, but changing max_jobs to an actual number (using 10 here) actually seems to work! ¯_(ツ)_/¯ Hopefully if anyone else has this odd problem they can just see this thread 😄

garymh avatar Dec 20 '20 05:12 garymh

Hmm. That's actually concerning, since it points to an error in the async/jobs code.

If anyone else has this problem and finds this issue, please comment or re-open. Since I haven't been able to reproduce this bug yet, I'd be very interested to hear about any new reports of the behavior.

wbthomason avatar Dec 21 '20 15:12 wbthomason

I started seeing a similar issue recently. When doing PackerSync 4 plugins would just hang with a "checking current commit" message. I deleted site/pack/packer to see if it was an issue with one of the installed plugins and on reinstall got the same bad argument #1 to 'is_active' (Expected uv_handle userdata) message which led me here. Setting a max_jobs value does seem to fix the issue. Edit: a smallish value, 50 works but 100 causes the same hang.

ranebrown avatar Mar 01 '21 15:03 ranebrown

Hmm. I'm going to reopen this, since it seems like there's something wrong (though I'm not sure if it's in Neovim, Luv, or packer).

wbthomason avatar Mar 03 '21 18:03 wbthomason

I've seen similar behavior. Haven't narrowed down the exact root cause yet but a few observations below. My dotfiles are online here but I barely know what I'm doing with the configs since I just switched over most of it to lua.

  • When I remove impatient.nvim and coc.nvim it seems to resolve itself
  • I've seen a couple merge conflicts pop up in the actual folders (manually inspecting them), I wonder if there aren't more that could be breaking/hanging
  • One of the merge conflicts was with coc.nvim
  • I have had coc.nvim running, previously
  • I set my clone_timeout to 1 (is that seconds? minutes? I haven't admittedly read the docs but I assumed seconds) and received a message [packer.nvim] [WARN 23:43:21] jobs.lua:87: Killing git due to timeout! which worked as expected

I think it could be a bad clone/git pull causing the hang, but it's also possible that my config is just bad because I'm seeing some other behavior I don't expect (like RRethy/nvim-treesitter-textsubjects isn't installed alongside the other packs even thought it's specified in my plugins file.

git version 2.33.1
NVIM v0.6.0-dev+533-g653d96329
macOS 11.4 (m1 chip)

Happy to help spend some time pairing/debugging on my machine if this sounds like the same issue, since I can recreate this just be adding coc.nvim (usually) and sometimes impatient as well.

jaydorsey avatar Nov 02 '21 03:11 jaydorsey

Fascinating. I have the same git version and cannot reproduce the issue, so I think that theory may be (mostly) dead.

What I did notice when trying to PackerInstall with your config was the following:

1. Just cloning all of the plugins takes a long time. If you have a poor internet connection, you could easily be running into a timeout issue. `packer` should still be handling this more gracefully than it is, so there's still a bug, but your problem can maybe be resolved by tweaking the value of `git.clone_timeout` in the config.

2. Installing the `deoplete-gitlab` plugin caused an unexpected password prompt, which could maybe be hanging and blocking progress?

I have similar problem, how can I change git.clone_timeout?

fersdeveloper avatar Nov 24 '21 04:11 fersdeveloper

still have this issue, can't resolve it. tried set max_jobs to 50 / 20 / 10, set git.clone_timeout to 600, all not work

ilaipi avatar Mar 31 '22 05:03 ilaipi

same here

winkee01 avatar May 16 '22 13:05 winkee01

I cannot install any packages and get the same error on a new install of Fedora 36.

Git version 2.37.2. 

NVIM v0.7.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Cannot get VimPlug to work in vimscript in the init.lua either, so I am stuck without plugins for the moment :(

xosxos avatar Sep 02 '22 10:09 xosxos

@xosxos: Have you tried setting max_jobs or clone_timeout?

wbthomason avatar Sep 02 '22 14:09 wbthomason

@xosxos: Have you tried setting max_jobs or clone_timeout?

I just started working on it and this resolved itself on its own just by copy pasting the default settings to my config. Thus I am left quite puzzled. Maybe it was a networking error after all..? Although I was browsing Github at the same time this issue popped up and cloning the Packer repo was also successful from the command line...

xosxos avatar Sep 02 '22 15:09 xosxos