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

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

Open Sanart0 opened this issue 1 year ago • 12 comments

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 avatar May 10 '23 16:05 Sanart0

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?

matbme avatar May 11 '23 14:05 matbme

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

Sanart0 avatar May 11 '23 14:05 Sanart0

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?

matbme avatar May 11 '23 14:05 matbme

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.

Sanart0 avatar May 11 '23 14:05 Sanart0

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.

AlexisFinn avatar Jul 18 '23 14:07 AlexisFinn

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

jeff-dh avatar Jul 19 '23 01:07 jeff-dh

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 avatar Jul 19 '23 01:07 jeff-dh

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).

https://github.com/matbme/JABS.nvim/blob/b6dbd1a3e1b8cef3d6ebfafe96c2230ca341b65f/lua/jabs.lua#L615-L618 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).

jeff-dh avatar Jul 19 '23 01:07 jeff-dh

@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...

AlexisFinn avatar Jul 21 '23 16:07 AlexisFinn

I think you did everything right regarding the :ls command.

Does it really output ligne? Not line?

If that's the case, that's the issue! Are you running nvim in French?

Try to set the config value sort_mru = true, this might be a work around.

Anyway, if the expJABS branch solves your issue, I would suggest to just keep on going with it..... but it will have the same issue concerning line vs ligne and the sort_mru work around should work aswell. I might have a look at it and can try to add multilanguage support to expJABS.

jeff-dh avatar Jul 21 '23 16:07 jeff-dh

Yeah, the non English language of nvim is pretty sure the issue..... JABS uses a regexp that "greps" for "line" to parse the output of :ls, if nvim does not run in English... well... it can't find line and thus calls some functions with nil values which causes a crash, which causes a partially global state, which causes the other error.

jeff-dh avatar Jul 21 '23 16:07 jeff-dh

So, it turned out that the reason why expJABS is not affected by this issue is, that sort_mru = true is the default in expJABS otherwise it produces very similar issues.

I added "multi language support" to expJABS (at least for the line issue). Could you give the latest expJABS a try with explicitly setting sort_mru = false to test it and whether there are other issues concerning multi language support?

Thanks!

jeff-dh avatar Jul 21 '23 16:07 jeff-dh