nvim-tree/nvim-tree.lua

Invalid 'group' error after recent commits (#3170)

Closed this issue · 4 comments

Description

After updating to the latest nvim-tree.lua (commit dd2364f from 05/08/25 ), I started getting this error when opening the tree:

Error detected while processing BufEnter Autocommands for "*":
Error executing lua callback: .../nvim-tree/explorer/view.lua:111: Invalid 'group': 60
stack traceback:
[C]: in function 'nvim_create_autocmd'
.../nvim-tree/explorer/view.lua:111: in function 'create_autocmds'
.../nvim-tree/explorer/view.lua:225: in function 'create_buffer'
.../nvim-tree/explorer/view.lua:539: in function 'open_in_win'
.../nvim-tree/lib.lua:121: in function 'open'
.../nvim-tree/actions/root/change-dir.lua:92: in function 'f'
.../nvim-tree/actions/root/change-dir.lua:77: in function 'force_dirchange'
.../nvim-tree.lua:111: in function <.../nvim-tree.lua:98>


This did not happen before the recent refactor commits (`#3170` and `#3174`).

---

### Steps to Reproduce
1. Install `nvim-tree` via `lazy.nvim`.
2. Use the following minimal config:

```lua
return {
 "nvim-tree/nvim-tree.lua",
 commit = "a9156c0",
 dependencies = { "DaikyXendo/nvim-material-icon" },
 keys = {
  { "<leader>e", function() require('nvim-tree.api').tree.focus() end, desc = "Focus file explorer" },
  { "<C-b>", "<cmd>NvimTreeToggle<cr>", desc = "Toggle file explorer" },
 },
 config = function()
    local tree_opened = false
    require("nvim-tree").setup({

     renderer = {
       icons = {
         webdev_colors = true,
       },
       group_empty = true,
     },
     sort_by = "case_sensitive",
     view = {
       width = 30,
       side = "right"
     },
     filters = {
       dotfiles = false,
       -- custom = { ".git" },
     },
     update_focused_file = {
       enable = true,
       update_cwd = false,
       update_root = false,
       ignore_list = {},
     },
     on_attach = function(bufnr)
       local api = require("nvim-tree.api")

       if not tree_opened then
          tree_opened = true
          api.tree.change_root_to_node()
       end
      api.config.mappings.default_on_attach(bufnr)
      
      -- Only overriding file opening behavior
      vim.keymap.set('n', '<C-j>', function()
        local node = api.tree.get_node_under_cursor()
        if node.type == "file" then
          local last_win = vim.fn.winnr('#')
          if last_win > 0 and vim.api.nvim_win_is_valid(last_win) then
            vim.cmd(last_win .. "wincmd w")
            vim.cmd("edit " .. node.absolute_path)
          else
            api.node.open.edit()
          end
        end
      end, { buffer = bufnr })
      
      end,
   })
 end,
}
  1. Open Neovim under a folder and the error will show:
$ nvim some/folder/path
  1. Error appears.

Expected Behavior

The tree should open without any errors.


Actual Behavior

The error above appears immediately when the tree opens.


Environment

  • **Neovim version: 0.11.2
  • OS: macOS
  • nvim-tree commit: dd2364f (4 days ago)
  • Plugin manager: lazy.nvim

Additional Info

  • Rolling back to commit a9156c0 (from 24/07/25) fixes the problem.
  • Seems related to augroup handling in the refactor commits #3170 and #3174.


### Neovim version

```text
NVIM v0.11.2
Build type: Release
LuaJIT 2.1.1748459687

Operating system and version

macOs Sequoia 15.4

Windows variant

No response

nvim-tree version

version was * and now using commit a9156c0 (the one that the problem do not exits)

Clean room replication

return {
 "nvim-tree/nvim-tree.lua",
 commit = "a9156c0",
 dependencies = { "DaikyXendo/nvim-material-icon" },
 keys = {
  { "<leader>e", function() require('nvim-tree.api').tree.focus() end, desc = "Focus file explorer" },
  { "<C-b>", "<cmd>NvimTreeToggle<cr>", desc = "Toggle file explorer" },
 },
 config = function()
    local tree_opened = false
    require("nvim-tree").setup({

     renderer = {
       icons = {
         webdev_colors = true,
       },
       group_empty = true,
     },
     sort_by = "case_sensitive",
     view = {
       width = 30,
       side = "right"
     },
     filters = {
       dotfiles = false,
       -- custom = { ".git" },
     },
     update_focused_file = {
       enable = true,
       update_cwd = false,
       update_root = false,
       ignore_list = {},
     },
     on_attach = function(bufnr)
       local api = require("nvim-tree.api")

       if not tree_opened then
          tree_opened = true
          api.tree.change_root_to_node()
       end
       -- Use all default mappings
      api.config.mappings.default_on_attach(bufnr)
      
      -- Only override file opening behavior
      vim.keymap.set('n', '<C-j>', function()
        local node = api.tree.get_node_under_cursor()
        if node.type == "file" then
          local last_win = vim.fn.winnr('#')
          if last_win > 0 and vim.api.nvim_win_is_valid(last_win) then
            vim.cmd(last_win .. "wincmd w")
            vim.cmd("edit " .. node.absolute_path)
          else
            api.node.open.edit()
          end
        end
      end, { buffer = bufnr })
      
      end,
   })
 end,
}

Steps to reproduce

  1. nvim some/folder/path

Expected behavior

Before the update nvim-tree simply started as the single buffer and then I opened another file buffers and nvim stayed on it's position (right, my custom config)

Actual behavior

Error detected while processing BufEnter Autocommands for "*":
Error executing lua callback: .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/view.lua:111: Invalid 'group': 60
stack traceback:
[C]: in function 'nvim_create_autocmd'
.../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/view.lua:111: in function 'create_autocmds'
.../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/view.lua:225: in function 'create_buffer'
.../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/view.lua:539: in function 'open_in_win'
...ocal/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/lib.lua:121: in function 'open'
.../nvim-tree.lua/lua/nvim-tree/actions/root/change-dir.lua:92: in function 'f'
.../nvim-tree.lua/lua/nvim-tree/actions/root/change-dir.lua:77: in function 'force_dirchange'
...o/.local/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree.lua:111: in function <...o/.local/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree.lua:98>

Thanks for letting me know and providing all these details.

Recent changes have been reverted. Please update to latest and advise whether the problem is resolved.

Thanks, got you.

Apologies, this issue shouldn't have been closed. It was auto-closed after the PR was merged.

Looking at #3182 now.

All the multi-instance view related changes have now been reverted: #3181

Thank you again for raising this and I'd be really grateful for your reports on any other such issues.