Skip to content

BUG: Buffer with this name already exists  #1365

@SparrowMike

Description

@SparrowMike

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.9.5

Operating System / Version

macOS - 14.2.1

Describe the Bug

When loading into a previous session that had neo-tree enabled I simply get the a blank window, whenever I toggle the neo-tree I get another blank window followed by a error:

[Neo-tree ERROR] debounce filesystem_navigate error: ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1045: Vim:E95: Buffer with this name already exists

I believe the issue has something to do with auto-sessions as disabling it makes the problem go away.

Screenshots, Traceback

The first image is loading into a session and the blank window on the right is what I think should be the neo-tree
Screenshot 2024-02-27 at 9 52 11 PM

At the bottom of the screen the error can be seen - it was triggered by the hotkey that I used to enable the neo-tree window, there is also an additional window, I believe this is where neo-tree tries to load into but its buffer already exists?
Screenshot 2024-02-27 at 9 52 37 PM

Steps to Reproduce

  1. neo-tree and auto-session plugin installed
  2. open any project, have some files open as well as neo-tree enabled
  3. close session with some file and neo-tree enabled
  4. open up the session

Expected Behavior

No errors?

Your Configuration

My neo-tree
{
    "nvim-neo-tree/neo-tree.nvim",
    branch = "v3.x",
    dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
        "MunifTanjim/nui.nvim",
        -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
        -- {
        "s1n7ax/nvim-window-picker",
        version = "2.*",
        config = function()
            require("window-picker").setup({
                filter_rules = {
                    include_current_win = false,
                    autoselect_one = true,
                    -- filter using buffer options
                    bo = {
                        -- if the file type is one of following, the window will be ignored
                        filetype = { "neo-tree", "neo-tree-popup", "notify" },
                        -- if the buffer type is one of following, the window will be ignored
                        buftype = { "terminal", "quickfix" },
                    },
                },
            })
        end,
    },
    config = function()
        local config = require("neo-tree")
        config.setup({
            event_handlers = {
                {
                    event = "neo_tree_buffer_enter",
                    handler = function(arg)
                        vim.cmd([[setlocal relativenumber]])
                    end,
                },
            },
            window = {
                position = "right",
            },
            filesystem = {
                follow_current_file = {
                    enabled = false, -- This will find and focus the file in the active buffer every time
                },
                filtered_items = {
                    hide_dotfiles = false,
                },
            },
        })

        vim.keymap.set("n", "<C-B>", ":Neotree source=filesystem toggle position=right<CR>")
        vim.keymap.set("n", "<C-G>", ":Neotree float git_status<CR>")
    end,
}


auto-session
{
        'rmagatti/auto-session',
        config = function()
            require("auto-session").setup {
                log_level = "error",
                auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/"},
            }
        end
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions