Skip to content

bug: nvim_get_current_buf must not be called in a fast event context #2945

@guijun

Description

@guijun

Describe the bug

Error executing callback:
...al/share/nvim/lazy/avante.nvim/lua/avante/utils/root.lua:202: E5560: nvim_get_current_buf must not be called in a fast event context
stack traceback:
[C]: in function 'nvim_get_current_buf'
...al/share/nvim/lazy/avante.nvim/lua/avante/utils/root.lua:202: in function 'get'
...al/share/nvim/lazy/avante.nvim/lua/avante/utils/file.lua:44: in function 'is_in_project'
...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:1352: in function 'uniform_path'
.../share/nvim/lazy/avante.nvim/lua/avante/history/init.lua:66: in function 'collect_tool_info'
.../share/nvim/lazy/avante.nvim/lua/avante/history/init.lua:297: in function 'update_tool_invocation_history'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2539: in function 'get_history_messages_for_api'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2894: in function 'cb'
...in/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:96: in function 'on_stop'
...in/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:702: in function '_user_on_exit'
.../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.lua:241: in function '_shutdown'

To reproduce

No response

Expected behavior

No response

Installation method

Use lazy.nvim:

{
  "yetone/avante.nvim",
  event = "VeryLazy",
  lazy = false,
  version = false, -- set this if you want to always pull the latest change
  opts = {
    -- add any opts here
  },
  -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
  build = "make",
  -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
  dependencies = {
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
  },
}

Environment

linux neovim 0.11.6

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    -- add any other plugins here
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions