From b62b6370fcf32c3b10dfb24d1150b4c16f52902f Mon Sep 17 00:00:00 2001 From: Nayab Sayed <6679112+ItsNayabSD@users.noreply.github.com> Date: Sun, 21 Dec 2025 16:05:19 +0530 Subject: [PATCH] fix: wrap nvim_del_autocmd in vim.schedule to avoid fast event context error (#2873) nvim_del_autocmd was being called in a callback from acp_client, which is a fast event context where it's not allowed. Wrapping it with vim.schedule() defers the execution to a safe context. Signed-off-by: Nayab Sayed --- lua/avante/llm.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/avante/llm.lua b/lua/avante/llm.lua index cbab279..440f9f5 100644 --- a/lua/avante/llm.lua +++ b/lua/avante/llm.lua @@ -1595,7 +1595,7 @@ function M._continue_stream_acp(opts, acp_client, session_id) }) acp_client:send_prompt(session_id, prompt, function(_, err_) if cancelled then return end - api.nvim_del_autocmd(stop_cmd_id) + vim.schedule(function() api.nvim_del_autocmd(stop_cmd_id) end) if err_ then -- ACP-specific session recovery: Check for session not found error -- Check for session recovery conditions