bug: neovim freezes when avante is enabled
Describe the bug
I'm using lazyvim with some additional plugins. When enabling Avante, the whole nvim is freezing and I have to kill process.
To reproduce
Add Avante to config and launch Neovim
Expected behavior
It shouldn't freeze the editor
Installation method
Use lazy.nvim:
{
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
enabled = true,
version = false, -- set this if you want to always pull the latest change
opts = {
-- add any opts here
provider = "claude",
-- cursor_applying_provider = "groq",
-- behaviour = {
-- --- ... existing behaviours
-- enable_cursor_planning_mode = true, -- enable cursor planning mode!
-- },
vendors = {
groq = { -- define groq provider
__inherited_from = "openai",
api_key_name = "OPENROUTER_API_KEY",
endpoint = "https://openrouter.ai/api/v1",
model = "meta-llama/llama-3.3-70b-instruct:nitro",
max_tokens = 32768, -- remember to increase this value, otherwise it will stop generating halfway
},
google_openrouter = {
__inherited_from = "openai",
api_key_name = "OPENROUTER_API_KEY",
endpoint = "https://openrouter.ai/api/v1",
model = "google/gemini-2.0-flash-001",
max_tokens = 8192, -- remember to increase this value, otherwise it will stop generating halfway
},
},
rag_service = {
enabled = true, -- Enables the RAG service
host_mount = os.getenv("HOME"), -- Host mount path for the rag service
provider = "openai", -- The provider to use for RAG service (e.g. openai or ollama)
llm_model = "", -- The LLM model to use for RAG service
embed_model = "", -- The embedding model to use for RAG service
endpoint = "https://api.openai.com/v1", -- The API endpoint for RAG service
},
},
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"echasnovski/mini.pick", -- for file_selector provider mini.pick
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"ibhagwan/fzf-lua", -- for file_selector provider fzf
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}
Environment
NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1736781742
installed via brew
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 = {
{
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
enabled = true,
version = false, -- set this if you want to always pull the latest change
opts = {
-- add any opts here
provider = "claude",
-- cursor_applying_provider = "groq",
-- behaviour = {
-- --- ... existing behaviours
-- enable_cursor_planning_mode = true, -- enable cursor planning mode!
-- },
vendors = {
groq = { -- define groq provider
__inherited_from = "openai",
api_key_name = "OPENROUTER_API_KEY",
endpoint = "https://openrouter.ai/api/v1",
model = "meta-llama/llama-3.3-70b-instruct:nitro",
max_tokens = 32768, -- remember to increase this value, otherwise it will stop generating halfway
},
google_openrouter = {
__inherited_from = "openai",
api_key_name = "OPENROUTER_API_KEY",
endpoint = "https://openrouter.ai/api/v1",
model = "google/gemini-2.0-flash-001",
max_tokens = 8192, -- remember to increase this value, otherwise it will stop generating halfway
},
},
rag_service = {
enabled = true, -- Enables the RAG service
host_mount = os.getenv("HOME"), -- Host mount path for the rag service
provider = "openai", -- The provider to use for RAG service (e.g. openai or ollama)
llm_model = "", -- The LLM model to use for RAG service
embed_model = "", -- The embedding model to use for RAG service
endpoint = "https://api.openai.com/v1", -- The API endpoint for RAG service
},
},
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"echasnovski/mini.pick", -- for file_selector provider mini.pick
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"ibhagwan/fzf-lua", -- for file_selector provider fzf
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
} -- add any other plugins here
},
})
Ok, it's connected with the Docker engine. When Docker is in a bad state, Avante waits for it while locking the nvim UI.
I also have this happen occasionally. It's not clear what causes it but neovim becomes fully locked.
This is also happening to me. Thought I was going crazy.
Definitely happens after i ask a question in the avante chat. But it's not consistent. Not certain what's going on.
I attached gdb after it happened, gdb (which nvim) and did a backtrace
GDB backtrace output
```gdb 0x00007f92f8a5d7dd in ts_subtree_retain (self=self@entry=...) at lib/src/subtree.c:584 584 void ts_subtree_retain(Subtree self) { (gdb) bt #0 0x00007f92f8a5d7dd in ts_subtree_retain (self=self@entry=...) at lib/src/subtree.c:584 #1 0x00007f92f8a5ec7f in stack__iter (self=No idea if this is helpful but... there it is.
Let me know if there is anything else I can debug next time this happens.
This is also happening to me. Thought I was going crazy.
Definitely happens after i ask a question in the avante chat. But it's not consistent. Not certain what's going on.
I attached gdb after it happened,
gdb (which nvim)and did a backtraceGDB backtrace output
gdb 0x00007f92f8a5d7dd in ts_subtree_retain (self=self@entry=...) at lib/src/subtree.c:584 584 void ts_subtree_retain(Subtree self) { (gdb) bt #0 0x00007f92f8a5d7dd in ts_subtree_retain (self=self@entry=...) at lib/src/subtree.c:584 [#1](https://github.com/yetone/avante.nvim/issues/1) 0x00007f92f8a5ec7f in stack__iter (self=, version=, callback=0x7f92f8a5c200 , payload=0x7fff320cf6b0, goal_subtree_count=) at lib/src/stack.c:401 [#2](https://github.com/yetone/avante.nvim/pull/2) 0x00007f92f8a46968 in ts_stack_pop_count (self=, version=0, count=5) at lib/src/stack.c:524 [#3](https://github.com/yetone/avante.nvim/issues/3) ts_parser__recover_to_state (self=, version=0, depth=5, goal_state=1042) at lib/src/parser.c:1188 [#4](https://github.com/yetone/avante.nvim/pull/4) ts_parser__recover (self=0x56516d22dd10, version=0, lookahead=...) at lib/src/parser.c:1298 [#5](https://github.com/yetone/avante.nvim/pull/5) 0x00007f92f8a4de3d in ts_parser__handle_error (self=0x56516d22dd10, version=, lookahead=...) at lib/src/parser.c:1511 [#6](https://github.com/yetone/avante.nvim/issues/6) ts_parser__condense_stack (self=) at lib/src/parser.c:1813 [#7](https://github.com/yetone/avante.nvim/pull/7) ts_parser_parse (self=self@entry=0x56516d22dd10, old_tree=old_tree@entry=0x0, input=...) at lib/src/parser.c:2083 [#8](https://github.com/yetone/avante.nvim/pull/8) 0x000056514b3514b0 in parser_parse (L=0x7f92f8a09380) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/lua/treesitter.c:360 [#9](https://github.com/yetone/avante.nvim/pull/9) 0x00007f92f8771a8b in lj_BC_FUNCC () at buildvm_x86.dasc:859 [#10](https://github.com/yetone/avante.nvim/pull/10) 0x00007f92f8785ba9 in lua_pcall (L=L@entry=0x7f92f8a09380, nargs=nargs@entry=5, nresults=nresults@entry=1, errfunc=errfunc@entry=-7) at /usr/src/debug/luajit-2.1.1720049189-1.fc41.x86_64/src/lj_api.c:1122 [#11](https://github.com/yetone/avante.nvim/pull/11) 0x000056514b340e8b in nlua_pcall (lstate=0x7f92f8a09380, nargs=5, nresults=1) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/lua/executor.c:173 [#12](https://github.com/yetone/avante.nvim/pull/12) 0x000056514b34e54f in nlua_call_ref (ref=, name=, args=..., mode=kRetNilBool, arena=0x0, err=0x7fff320cfb60) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/lua/executor.c:1605 [#13](https://github.com/yetone/avante.nvim/pull/13) 0x000056514b26e0cf in decor_provider_invoke (provider_idx=provider_idx@entry=4, name=name@entry=0x56514b4fe6d1 "win", ref=, args=..., default_true=default_true@entry=true) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/decoration_provider.c:51 [#14](https://github.com/yetone/avante.nvim/pull/14) 0x000056514b26e800 in decor_providers_invoke_win (wp=0x565167fe6270) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/decoration_provider.c:144 [#15](https://github.com/yetone/avante.nvim/pull/15) 0x000056514b27e39b in win_update (wp=wp@entry=0x565167fe6270) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/drawscreen.c:1510 [#16](https://github.com/yetone/avante.nvim/issues/16) 0x000056514b280985 in update_screen () at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/drawscreen.c:647 [#17](https://github.com/yetone/avante.nvim/issues/17) 0x000056514b2e67d5 in ex_redraw (eap=0x7fff320cfee0) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/ex_docmd.c:6348 [#18](https://github.com/yetone/avante.nvim/pull/18) 0x000056514b2dab87 in execute_cmd0 (retv=retv@entry=0x7fff320cfed4, eap=eap@entry=0x7fff320cfee0, errormsg=errormsg@entry=0x7fff320cfed8, preview=preview@entry=false) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/ex_docmd.c:1706 [#19](https://github.com/yetone/avante.nvim/pull/19) 0x000056514b2dc450 in do_one_cmd (cmdlinep=cmdlinep@entry=0x7fff320d0138, flags=flags@entry=7, cstack=cstack@entry=0x7fff320d01c0, fgetline=fgetline@entry=0x56514b40a415 , cookie=cookie@entry=0x7fff320d0870) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/ex_docmd.c:2375 [#20](https://github.com/yetone/avante.nvim/pull/20) 0x000056514b2dd002 in do_cmdline (cmdline=, fgetline=0x56514b40a415 , cookie=0x7fff320d0870, flags=7) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/ex_docmd.c:665 [#21](https://github.com/yetone/avante.nvim/issues/21) 0x000056514b40a6db in source_using_linegetter ( cookie=cookie@entry=0x7fff320d0870, fgetline=fgetline@entry=0x56514b40a415 , traceback_name=) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/runtime.c:1980 [#22](https://github.com/yetone/avante.nvim/pull/22) 0x000056514b40a75e in do_source_str (cmd=, traceback_name=) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/runtime.c:2030 [#23](https://github.com/yetone/avante.nvim/issues/23) 0x000056514b23b695 in exec_impl (channel_id=9223372036854775809, src=..., opts=opts@entry=0x7fff320d0997, err=err@entry=0x7fff320d09a0) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/api/vimscript.c:89 [#24](https://github.com/yetone/avante.nvim/pull/24) 0x000056514b23b7cd in nvim_exec2 (channel_id=, src=..., opts=0x7fff320d0997, err=0x7fff320d09a0) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/api/vimscript.c:58 [#25](https://github.com/yetone/avante.nvim/issues/25) 0x000056514b33e55f in nlua_api_nvim_exec2 (lstate=0x7f92f8a09380) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/redhat-linux-build/src/nvim/auto/lua_api_c_bindings.generated.h:7375 [#26](https://github.com/yetone/avante.nvim/issues/26) 0x00007f92f8771a8b in lj_BC_FUNCC () at buildvm_x86.dasc:859 [#27](https://github.com/yetone/avante.nvim/pull/27) 0x00007f92f8785ba9 in lua_pcall (L=L@entry=0x7f92f8a09380, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=-2) at /usr/src/debug/luajit-2.1.1720049189-1.fc41.x86_64/src/lj_api.c:1122 [#28](https://github.com/yetone/avante.nvim/pull/28) 0x000056514b340e8b in nlua_pcall (lstate=lstate@entry=0x7f92f8a09380, nargs=nargs@entry=0, nresults=nresults@entry=0) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/lua/executor.c:173 [#29](https://github.com/yetone/avante.nvim/pull/29) 0x000056514b348edf in nlua_schedule_event (argv=) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/lua/executor.c:370 [#30](https://github.com/yetone/avante.nvim/issues/30) 0x000056514b43f17f in state_handle_k_event () at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/state.c:121 [#31](https://github.com/yetone/avante.nvim/issues/31) 0x000056514b39ca0c in nv_event (cap=0x7fff320d0c50) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/normal.c:6586 [#32](https://github.com/yetone/avante.nvim/issues/32) 0x000056514b395bb9 in normal_execute (state=0x7fff320d0be0, key=) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/normal.c:1229 [#33](https://github.com/yetone/avante.nvim/pull/33) 0x000056514b43f05d in state_enter (s=0x7fff320d0be0) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/state.c:103 [#34](https://github.com/yetone/avante.nvim/pull/34) 0x000056514b394769 in normal_enter (cmdwin=false, noexmode=false) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/normal.c:518 [#35](https://github.com/yetone/avante.nvim/issues/35) 0x000056514b35c341 in main (argc=5, argv=) at /usr/src/debug/neovim-0.10.4-1.fc41.x86_64/src/nvim/main.c:662No idea if this is helpful but... there it is.Let me know if there is anything else I can debug next time this happens.
This might be related to Docker. Have you enabled the RAG service?
thanks for the response! i do not have the RAG/docker stuff enabled. this is my config:
{
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- Set this to "*" to always pull the latest release version, or set it to false to update to the latest code changes.
opts = {
-- add any opts here
mappings = {
ask = "<leader>va",
edit = "<leader>ve",
refresh = "<leader>vr",
focus = "<leader>vf",
toggle = {
default = "<leader>vt",
debug = "<leader>vd",
hint = "<leader>vh",
suggestion = "<leader>vs",
repomap = "<leader>vR",
},
files = {
add_current = "<leader>vc",
},
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
dependencies = {
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
},
},
I did notice I wasn't on the most recent release of avante, and #1601 indicates some fixes, so I've updated and I'll update if I see the problem again with this newer version.
I also do not use RAG, and am on commit 540cc53. Anecdotally I do not see the freezes occur when using OpenAI + gpt-4o, only when using Claude + claude-3-7-sonnet-20250219. It only freezes during completion, and generally only in the middle of a code block.
My config is essentially the recommended one:
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- Set this to "*" to always pull the latest release version, or set it to false to update to the latest code changes.
opts = {
-- -- add any opts here
-- -- for example
-- provider = "claude",
-- openai = {
-- endpoint = "https://api.anthropic.com",
-- model = "claude-3-7-sonnet-20250219", -- your desired model (or use gpt-4o, etc.)
-- timeout = 30000, -- timeout in milliseconds
-- temperature = 0, -- adjust if needed
-- max_tokens = 4096,
-- -- reasoning_effort = "high" -- only supported for reasoning models (o1, etc.)
-- },
-- add any opts here
-- for example
provider = "openai",
openai = {
endpoint = "https://api.openai.com/v1",
model = "gpt-4o", -- your desired model (or use gpt-4o, etc.)
timeout = 30000, -- timeout in milliseconds
temperature = 0, -- adjust if needed
max_tokens = 4096,
-- reasoning_effort = "high" -- only supported for reasoning models (o1, etc.)
},
},
-- 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-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"echasnovski/mini.pick", -- for file_selector provider mini.pick
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"ibhagwan/fzf-lua", -- for file_selector provider fzf
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.