avante.nvim icon indicating copy to clipboard operation
avante.nvim copied to clipboard

bug: Avante does not give diffs that I can apply, it only seems to show the entire file in the side bar

Open theahura opened this issue 7 months ago • 7 comments

Describe the bug

In a given file, if I ask for something like:

"Add a new function that returns foobar"

Instead of giving a diff, I will get the entire file back, with no ability to actually apply any changes from the sidebar directly. It looks like the system is trying to use tools:

Image

Besides being a huge waste of tokens, this really breaks the workflow of chat --> get change --> apply change --> review change and edit --> chat, since there is no longer a functional apply step for diffs. This problem occurs even if I ask for search replace blocks, as per https://github.com/yetone/avante.nvim/blob/af80a1ad7819f188f093fbb1a7566d324ad9452f/lua/avante/templates/planning.avanterules

I assume something changed with the generation prompts? Note that I have tool_use disabled, and am using gemini.

To reproduce

Open a file with existing code in it, input "Add a new function that returns foobar"

Expected behavior

I would get SEARCH/REPLACE blocks, as before, with just the requested change instead of the entire file diff.

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

nvim 0.10.2 Ubuntu 20.04

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
  },
})

theahura avatar May 02 '25 17:05 theahura

Even with the tool use on, I regularly get this error when it tries to use the replace_in_file tool, which it does constantly

Error: {
  code = 500,
  message = "An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting",
  status = "INTERNAL"
}

IDK what changed, but this has totally broken avante for me

theahura avatar May 02 '25 19:05 theahura

Completely agree with you on the workflow :) Have you tried adding mode = "legacy"

digego avatar May 04 '25 23:05 digego

I didn't know that mode existed, I ended up just reverting my entire lock file back 3 weeks 😂 will give that shot when I'm back at my keyboard

theahura avatar May 05 '25 00:05 theahura

+1, this breaks all my workflow. Just try to print all the file again without search/replace blocks. I will try to fix the version for make this works as before :o

a-chacon avatar May 08 '25 21:05 a-chacon

Agreed. This is a bit of a disaster... Did we screw up something in the config?

codr1 avatar May 10 '25 14:05 codr1

I'm having the same issue in a new install, but in another install seems to be working fine. Probably it is worth mentioning that in the broken one I'm using openai vs the good one where I use deepseek. Is there a way to rollback the version from Lazy?

patovala avatar May 16 '25 14:05 patovala

In your config file of avante just set the version as it:

return {
  "yetone/avante.nvim",
  event = "VeryLazy",
  version = "v0.0.23", -- HERE
  opts = {
    provider = "deepseek",

I was using deepseek and this don't works. (I mean with the main changes). But fixing the version works perfect. I just missed one feature that is adding all open buffers to the chat with just one shortcut.

a-chacon avatar May 16 '25 14:05 a-chacon

In your config file of avante just set the version as it:

return {
  "yetone/avante.nvim",
  event = "VeryLazy",
  version = "v0.0.23", -- HERE
  opts = {
    provider = "deepseek",

I was using deepseek and this don't works. (I mean with the main changes). But fixing the version works perfect. I just missed one feature that is adding all open buffers to the chat with just one shortcut.

Im getting just errors on that version

Error detected while processing TextChangedI Autocommands for "<buffer=10>":
Error executing lua callback: bad argument #2: error converting Lua nil to String (expected string or number)
stack traceback:
	[C]: in function 'initialize'
	...s/.local/share/nvim/lazy/avante.nvim/lua/avante/path.lua:185: in function 'initialize'
	...ps/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:112: in function 'generate_prompts'
	...ps/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:215: in function 'calculate_tokens'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2822: in function 'cb'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2415: in function 'get_generate_prompts_options'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2821: in function 'show_hint'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2835: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2834>

zeroknots avatar Jun 05 '25 12:06 zeroknots

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.

github-actions[bot] avatar Jul 06 '25 02:07 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jul 13 '25 02:07 github-actions[bot]