avante.nvim
avante.nvim copied to clipboard
bug: No permission to access path
Describe the bug
Avante complains that it does not have permission to access files:
After attempting to open it, it just deleted all the code in my file and was thus not able to find the code anymore.
I have no idea what is going on here. Is this plugin working for others and used in daily coding?
To reproduce
n/a/
Expected behavior
Expected it to have permissions.
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-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
}
Environment
v0.12
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
},
})
I do have the same error ever since updating, and the tools changed from showing the diff in the sidebar first to directly showing it in the files
Same issue after updating
I do have the same error ever since updating, and the tools changed from showing the diff in the sidebar first to directly showing it in the files
You can use mode = "legacy" to revert to the previous mode.
@yetone thank you for chiming in. Do you know if the file permission issue is fixed, or if it is a problem on my/our end?
Also, is it advisable to disable all the avante tools like described in the mcphub docs, when using the two together?
@magnusriga I have the same problem and I have disabled all the servers and mcphub plugin also but still no access
I'm also having the same issue
I am also having the same issue
Same issue with latest Avante + MCPHub here.
Related Plugin Versions:
Error Message by LLM:
╭─ replace_in_file failed
│ running tool
│ path: /home/user/mcphub/servers.json
╰─ Error: No permission to access path: /home/user/.config/mcphub/servers.json
I encountered an issue while trying to update the configuration file. It seems I don't have the necessary permissions to access `/home/user/.config/mcphub/servers.json`.
Could you please ensure that I have the correct permissions to modify this file?
Same issue here
Using AI I was able to patch this locally temporarily:
➜ git diff
diff --git a/lua/avante/llm_tools/helpers.lua b/lua/avante/llm_tools/helpers.lua
index ef6cfe9..f478913 100644
--- a/lua/avante/llm_tools/helpers.lua
+++ b/lua/avante/llm_tools/helpers.lua
@@ -75,7 +75,11 @@ end
function M.has_permission_to_access(abs_path)
if not Path:new(abs_path):is_absolute() then return false end
local project_root = Utils.get_project_root()
- if abs_path:sub(1, #project_root) ~= project_root then return false end
+ -- allow if inside project root OR inside user config dir
+ local config_dir = vim.fn.stdpath('config')
+ local in_project = abs_path:sub(1, #project_root) == project_root
+ local in_config = abs_path:sub(1, #config_dir) == config_dir
+ if not in_project and not in_config then return false end
return not M.is_ignored(abs_path)
end
Note that I am seeing the codebase for the first time so please take the above with a grain of salt :)
My problem was that the agent was trying to modify a file in my config directory. You can adapt the fix for your usecase.
There is a bug problem and I cannot find a real solution . Could someone help or say that it will or not be fixed
I did some debugging and found that vim.fs.normalize converts backslashes () into forward slashes (/). This causes the project_root path to differ from abs_path when checking permissions. Can you remove M.norm or find another way for normalizing the path?
Same issue for windows 10
Same issue for windows11 23h2 10.0.22631.5335]
Unfortunately, AI plugins for nvim are lagging significantly behind the AI capabilities of most other major IDEs.
I tried Avante, CopilotChat, and CodeCompanion, with constant issues, ranging from permission denied, to rate limiting, to diff crashes.
I have now been testing vscode Agent mode for a week, without a single problem (when it comes to agentic AI work).
I wish the above was not the case, but the current difference in quality and stability is substantial, to the point where we are forced to step away from Neovim for AI coding work.
I prefer Neovim in every other way, so hoping it will catch up soon.
I have exactly same thoughts. I'd really hate to give up on the favorite editor because of it.
Me as well. What i have been doing is working with other ides for code generation, and using vin for manual adjustments. My workflow goes like: Ask modifications -> Accept suggestions if they make sense -> perform adjustments in neovim. Separating concerns between code generation and code manual writing has been the best approach imo. But of course, if i could do everything inside neovim it would be better.
Same issue on macos
I know is not the best solution, but by setting the config in legacy mode the plugin does work; not the best AI flow, but good enough for me tbh (specially combined with autosuggestion).
I really love the plugin, thanks for the effort on fixing this.
@Pakas342 Could you please tell me how to set this up?
@Vladipz On the config, set mode to 'legacy':
mode = 'legacy',
There's only two modes: . "agentic" uses tools to automatically generate code (the one that causes the issues and comes as default), "legacy" uses the old planning method to generate code.
only edit files where neovim was started. editing files outside of the project root is blocked. If you want to edit your config files, open neovim in your config directory.
After the update, the agentic mode is now working back again on my machine
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.
in my case, i didn't expect that avante will fail to read or update files ignored in git with "No permission to access path".