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

E5108: Error executing lua ... Invalid 'group': 'JABS' #48

Open
Sanart0 opened this issue May 10, 2023 · 12 comments
Open

E5108: Error executing lua ... Invalid 'group': 'JABS' #48

Sanart0 opened this issue May 10, 2023 · 12 comments

Comments

@Sanart0
Copy link

Sanart0 commented May 10, 2023

Hello,
i have a problem with JABS, when i run it (like :JABSOpen), i get an error.

For plugins i use Lazy.

This is my neovim lua config for JABS:

...
{"matbme/JABS.nvim",
	keys = {
		{ "<leader>b", "<cmd>JABSOpen<CR>" },
	},
	config = function ()
		require("jabs").setup ({
			position = {"center", "center"},
			border = 'single',
			keymap = {
				close = "d",
				h_split = "h",
				v_split = "v",
				preview = "p",
			},
			use_devicons = true
		})
end},
...

This is error message:

E5108: Error executing lua ~/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:546: Invalid 'group': 'JABS'                
stack traceback:
        [C]: in function 'nvim_clear_autocmds'
        ~.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:546: in function 'close'
        ~.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:621: in function 'open'
        [string ":lua"]:1: in main chunk
@Sanart0 Sanart0 closed this as completed May 10, 2023
@Sanart0 Sanart0 reopened this May 10, 2023
@matbme
Copy link
Owner

matbme commented May 11, 2023

I just tested your config and it works for me. What version of Neovim are you on? Also, are you using the latest version of the plugin?

@Sanart0
Copy link
Author

Sanart0 commented May 11, 2023

I use nvim v0.9.0, and the plugin is latest JABS version.
Also maybe it will be helpful, OS is Manjaro 22

@matbme
Copy link
Owner

matbme commented May 11, 2023

I haven't tested JABS with lazy.nvim yet, maybe the lazy loading is causing issues. Could you try setting the plugin to use lazy = false?

@Sanart0
Copy link
Author

Sanart0 commented May 11, 2023

I tried, and got the same error, but i think that problem is not with lazy, because my friend have Arch and he have a same config with JABS and lazy and it works well.

@AlexisFinn
Copy link

AlexisFinn commented Jul 18, 2023

Hello.
Any updates on this ? I am getting the same error, bot only on the second call. The first time I call it JABS gives me a different error that might help in determining the problem:

   Error  16:40:24 msg_show.lua_error   JABSOpen E5108: Error executing lua /home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:198: bad argument #1 to 'match' (string expected, got nil)
stack traceback:
	[C]: in function 'match'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:198: in function 'getFileSymbol'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:453: in function 'parseLs'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:587: in function 'refresh'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:616: in function 'open'
	[string ":lua"]:1: in main chunk
   Error  16:40:40 msg_show.lua_error   JABSOpen E5108: Error executing lua /home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:546: Invalid 'group': 'JABS'
stack traceback:
	[C]: in function 'nvim_clear_autocmds'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:546: in function 'close'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:621: in function 'open'
	[string ":lua"]:1: in main chunk

I have no config:

require("jabs").setup({})
local keymap = vim.api.nvim_set_keymap
keymap('n', '<F8>', ':JABSOpen<CR>', {})

But it does open an empty overlayed window in the bottom right hand, so I'm wondering if another plugin might be conflicting with the popup drawing.

@jeff-dh
Copy link
Contributor

jeff-dh commented Jul 19, 2023

@AlexisFinn could you provide the output of :ls and :ls t for the error you reported?

@jeff-dh
Copy link
Contributor

jeff-dh commented Jul 19, 2023

As an alternative you could check out this fork:

https://github.com/jeff-dh/expJABS.nvim

It's a refactored and enhanced version of JABS, that might not be affect by this issue.

@jeff-dh
Copy link
Contributor

jeff-dh commented Jul 19, 2023

It makes sense that a "previous" aborted call to JABS causes the error mentioned by @Sanart0 . Since this branch of the JABS plugin uses a global state. An aborted call to JABS might cause a partially initialized global state. The second call might think the state is initialized (because a certain variable is set) and call the close function. Since the state is not initialized correctly the close call fails and causes another error (because it can not find a supposed to be registered group name that would have been registered if the first call would not have been aborted).

JABS.nvim/lua/jabs.lua

Lines 615 to 618 in b6dbd1a

if M.main_win ~= 0 then
M.refresh(M.main_buf)
M.setKeymaps(M.back_win, M.main_buf)
M.set_autocmds()

Switching the order of these three lines might(!) solve the first issue, but would also be a hack. The refresh call is what caused the error mentioned by @AlexisFinn , the set_autocmds functions registers the group name "JABS" that was not found in the error mentioned by @Sanart0.

So there would be a causing issue (like @AlexisFinn reported) which causes a error in the error handling of jabs (as reported by @Sanart0).

@AlexisFinn
Copy link

AlexisFinn commented Jul 21, 2023

@jeff-dh sorry for late answer.

I can confirm using jeff-hd/expJABS.nvim does fix the issue.

Also I'm not sure I know what you mean by :ls and :ls t, but here's what I got right after I triggered the error:

   Error  18:06:07 msg_show.lua_error   JABSOpen E5108: Error executing lua /home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:198: bad argument #1 to 'match' (string expected, got nil)
stack traceback:
	[C]: in function 'match'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:198: in function 'getFileSymbol'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:453: in function 'parseLs'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:587: in function 'refresh'
	/home/alexis/.local/share/nvim/lazy/JABS.nvim/lua/jabs.lua:616: in function 'open'
	[string ":lua"]:1: in main chunk
18:06:16 msg_show   ls   3      "config/nvim/lua/plugin-configs/colorschemes.lua" ligne 1
  4      "config/nvim/lua/config.lua"   ligne 46
  5      "config/nvim/lua/plugin-configs/auto-session.lua" ligne 4
  6 #a   "config/nvim/lua/plugin-configs/JABS.lua" ligne 2
  7      "config/nvim/lua/plugin-configs/which-key.lua" ligne 1
18:06:20 msg_show   ls t   6 #a   "config/nvim/lua/plugin-configs/JABS.lua" il y a 15 secondes
  3      "config/nvim/lua/plugin-configs/colorschemes.lua" ligne 1
  4      "config/nvim/lua/config.lua"   ligne 46
  5      "config/nvim/lua/plugin-configs/auto-session.lua" ligne 4
  7      "config/nvim/lua/plugin-configs/which-key.lua" ligne 1

I don't know how to interpret this, I get it seems to be some kind of stack trace and if I had to guess which of the mentionned plugins in causing problems it would probably be auto-session but what do I know...

@jeff-dh
Copy link
Contributor

jeff-dh commented Jul 21, 2023 via email

@jeff-dh
Copy link
Contributor

jeff-dh commented Jul 21, 2023 via email

@jeff-dh
Copy link
Contributor

jeff-dh commented Jul 21, 2023 via email

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