Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: "attempt to call field 'lazy_table' (a nil value)" with Lazy.nvim #831

Closed
ziutech opened this issue Mar 17, 2023 · 6 comments
Closed

Comments

@ziutech
Copy link

ziutech commented Mar 17, 2023

Error is shown when opening neovim with config provided below. In my regular config, where I have more plugins, this bug is shown only sometimes (I open neovim three times - nothing happens; I open fourth time - it crashes), so maybe it's some kind of race condition? I don't fully understand how lazy loading works in neovim.

I'm not sure whether this bug report belongs here or in Lazy.nvim, but I thought it might be better to start here.

Error message

Error detected while processing BufWinEnter Autocommands for "*":
Error executing lua callback: ...ztof/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:737: attempt to call field 'lazy_table' (a nil value)
stack traceback:
        ...ztof/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:737: in main chunk
        [C]: in function 'require'
        ...share/nvim/lazy/LuaSnip/lua/luasnip/loaders/from_lua.lua:27: in main chunk
        [C]: in function 'require'
        ...ysztof/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:76: in function <...ysztof/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:75>
Error executing lua callback: .../nvim/lazy/LuaSnip/lua/luasnip/loaders/from_snipmate.lua:1: loop or previous error loading module 'luasnip'
stack traceback:
        [C]: in function 'require'
        .../nvim/lazy/LuaSnip/lua/luasnip/loaders/from_snipmate.lua:1: in main chunk
        [C]: in function 'require'
        ...ysztof/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:84: in function <...ysztof/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:83>
Error executing lua callback: ...re/nvim/lazy/LuaSnip/lua/luasnip/loaders/from_vscode.lua:1: loop or previous error loading module 'luasnip'
stack traceback:
        [C]: in function 'require'
        ...re/nvim/lazy/LuaSnip/lua/luasnip/loaders/from_vscode.lua:1: in main chunk
        [C]: in function 'require'
        ...ysztof/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:92: in function <...ysztof/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:91>

init.lua:

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"--single-branch",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)
require("lazy").setup({
	{
		"L3MON4D3/LuaSnip",
		build = "make install_jsregexp",
	},
})

Neovim version: v0.8.3

@leiserfg
Copy link
Contributor

Did you have packer before? If so, check if the old installation is still there (rm -r .local/share/nvim/ is the faster way).

@ziutech
Copy link
Author

ziutech commented Mar 17, 2023

Yup, removing ~/.local/share/nvim/site/pack/packer fixed it. Thanks and sorry!

@ziutech ziutech closed this as completed Mar 17, 2023
@leiserfg
Copy link
Contributor

Don't worry, I had the same issue 😄

@codeDude64
Copy link

codeDude64 commented Mar 19, 2023

Don't worry, I had the same issue smile

X3

Should this information be in the documentation 😆?

@leiserfg
Copy link
Contributor

I think it's better to pin this issue because this is not a Luasnip (only) problem and not everybody uses Lazy.

@L3MON4D3
Copy link
Owner

Good idea👍
Seems to be common enough xD

@L3MON4D3 L3MON4D3 pinned this issue Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants