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

bug: Getting 'winfixbuf' stack traceback error even though I beileve I am using the latest version

Open wakywayne opened this issue 8 months ago • 9 comments

Describe the bug

When I try to run Avante ask i get the following error on ubuntu linux: E5108: Error executing lua: ...g/.local/share/nvim/lazy/nui.nvim/lua/nui/utils/init.lua:158: Unknown option 'winfixbuf' stack traceback:

here is my lazy config for avante:

    {
      "yetone/avante.nvim",
      event = "VeryLazy",
      version = false, -- Never set this value to "*"! Never!
      opts = {
        -- add any opts here
        -- for example
        provider = "claude",
        claude = {
          endpoint = "https://api.anthropic.com",
          model = "claude-3-5-sonnet-20241022",
          temperature = 0,
          max_tokens = 8192,
        },
      },
      -- 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" },
        },
      },
    }

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-treesitter/nvim-treesitter",
    "stevearc/dressing.nvim",
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
  },
}

Environment

NVIM v0.10.0-dev-2315+g32b49448b Build type: RelWithDebInfo LuaJIT 2.1.1707061634

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

wakywayne avatar Apr 23 '25 05:04 wakywayne

Hey just following up on this issue. Can someone confirm or deny that my Lazy import is correct and using the latest version? I see users that have had this issue and claim that it was fixed with a newer version, but it seems I am getting it on the latest version.

wakywayne avatar May 01 '25 01:05 wakywayne

Is anyone able to help me with this please 🙏 @yetone I see that people have reported this issue and then say it goes away with a newer version,but I believe I am using the newest version based on my config right?

wakywayne avatar May 03 '25 02:05 wakywayne

‌‌‌You can try updating both neovim and avante to the latest versions and see if it works.

yetone avatar May 03 '25 06:05 yetone

@yetone I updated neovim. When I try to update Avante I get this error during the update:

Error executing vim.schedule lua callback: ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:211: lualine: Failed to refresh sta
tusline:                                                                                                                                  
/home/g/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:415: Error executing lua: ...im/lazy/lualine.nvim/lua/lualine/components/filen
ame.lua:73: attempt to index field 'config' (a nil value)                                                                                 
stack traceback:                                                                                                                          
        ...im/lazy/lualine.nvim/lua/lualine/components/filename.lua:73: in function 'update_status'                                       
        ...l/share/nvim/lazy/lualine.nvim/lua/lualine/component.lua:279: in function 'draw'                                               
        ...are/nvim/lazy/lualine.nvim/lua/lualine/utils/section.lua:26: in function 'draw_section'                                        
        /home/g/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:167: in function 'statusline'                                         
        /home/g/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:309: in function </home/g/.local/share/nvim/lazy/lualine.nvim/lua/lual
ine.lua:290>                                                                                                                              
        [C]: in function 'nvim_win_call'                                                                                                  
        /home/g/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:415: in function 'refresh'                                            
        /home/g/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:499: in function </home/g/.local/share/nvim/lazy/lualine.nvim/lua/lual
ine.lua:498>                                                                                                                              
        [C]: in function 'pcall'                                                                                                          
        ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:214: in function ''                                                   
        vim/_editor.lua: in function <vim/_editor.lua:0>                                                                                  
stack traceback:                                                                                                                          
        [C]: in function 'error'                                                                                                          
        ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:211: in function ''                                                   
        vim/_editor.lua: in function <vim/_editor.lua:0>                                                                                  
Press ENTER or type command to continue                               

I get this error after the update fails in lazy pannel:

       LUA_VERSION=luajit bash ./build.sh
        unknown flag: --clobber

        Usage:  gh release download [<tag>] [flags]

        Flags:
          -A, --archive format        Download the source code archive in the specified format (zip or tar.gz)
          -D, --dir string            The directory to download files into (default ".")
          -p, --pattern stringArray   Download only assets that match a glob pattern


        gzip: stdin: unexpected end of file
        tar: Child returned status 1
        tar: Error is not recoverable: exiting now
        make: *** [Makefile:46: luajit] Error 2

wakywayne avatar May 05 '25 19:05 wakywayne

Also if I try to run avante ask I get this error now:

Error detected while processing ModeChanged Autocommands for "*:i":
Error executing lua callback: .../g/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:148: Make sure to build avante (missing avante_templates)                                                                                                                         
stack traceback:                                                                                                                                                                                                                                                                      
        [C]: in function 'error'                                                                                                                                                                                                                                                      
        ...g/.local/share/nvim/lazy/avante.nvim/lua/avante/path.lua:186: in function 'get_templates_dir'                                                                                                                                                                              
        .../g/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:148: in function 'generate_prompts'                                                                                                                                                                               
        .../g/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:421: in function 'calculate_tokens'                                                                                                                                                                               
        ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2040: in function 'cb'                                                                                                                                                                                            
        ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2198: in function 'get_generate_prompts_options'                                                                                                                                                                  
        ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2039: in function 'show_input_hint'                                                                                                                                                                               
        ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2563: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2561>     

wakywayne avatar May 05 '25 19:05 wakywayne

@yetone do you have any idea why avante would not be able to update cleanly?

wakywayne avatar May 08 '25 17:05 wakywayne

Hey @wakywayne I was having this issue, too. I looked into the code and I noticed that --clobber is a flag for the gh cli. It seems the version that I had installed was a little bit old, so I installed the latest version from the GH Releases. After that, I tried make again and it worked. Hopefully that will work for you too 🍀

CristhianMotoche avatar May 30 '25 01:05 CristhianMotoche

To elaborate on @CristhianMotoche's answer, I also got this issue on Ubuntu. The apt version of gh is not up to date, hence you need to grab the .deb from GH releases

codeWonderland avatar May 30 '25 21:05 codeWonderland

Also if I try to run avante ask I get this error now:

Error detected while processing ModeChanged Autocommands for "*:i": Error executing lua callback: .../g/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:148: Make sure to build avante (missing avante_templates)
stack traceback:
[C]: in function 'error'
...g/.local/share/nvim/lazy/avante.nvim/lua/avante/path.lua:186: in function 'get_templates_dir'
.../g/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:148: in function 'generate_prompts'
.../g/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:421: in function 'calculate_tokens'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2040: in function 'cb'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2198: in function 'get_generate_prompts_options'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2039: in function 'show_input_hint'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2563: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2561>

https://github.com/yetone/avante.nvim/issues/612#issuecomment-2375729928

yetone avatar May 31 '25 00:05 yetone

this happen to today, some how :AvanteBuild create *.dylib files in lua folder. then this error disappear after changing BUILD_DIR := build in Makefile and rerun :AvanteBuild, now all *.dylib files in build folder instead

KienDangTran avatar Jun 27 '25 08:06 KienDangTran

this happen to today, some how :AvanteBuild create *.dylib files in lua folder. then this error disappear after changing BUILD_DIR := build in Makefile and rerun :AvanteBuild, now all *.dylib files in build folder instead

:AvanteBuild is an outdated command, and I will delete it next.

yetone avatar Jun 27 '25 08:06 yetone

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 Aug 12 '25 02:08 github-actions[bot]

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

github-actions[bot] avatar Aug 24 '25 02:08 github-actions[bot]

Sharing what I'm seeing from M1

[task] build 2875.99ms
                             LUA_VERSION=luajit bash ./build.sh
                             Local build is out of date . Downloading latest v0.0.27.
non-200 OK status code: 401 Unauthorized body: "{\"message\":\"This endpoint requires you to be authenticated.\",\"documentation_url\":\"https://docs.github.
                             com/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql\",\"status\":\"401\"}"

charlseo avatar Sep 09 '25 13:09 charlseo

confirmed this was due to no GH_TOKEN (actually I use private GHE) and now the error cleared

      remote: Counting objects: 100% (805/805), done.
                             remote: Compressing objects: 100% (199/199), done.
                             remote: Total 7754 (delta 720), reused 606 (delta 606), pack-reused 6949 (from 4)
                             Receiving objects: 100% (7754/7754), 1.96 MiB | 6.24 MiB/s, done.
                             Resolving deltas: 100% (3821/3821), done.
                           ✔ [task] checkout 3.96ms
                           ✔ [task] docs 0.09ms
                           ✔ [task] build 4473.14ms
                             LUA_VERSION=luajit bash ./build.sh
                             Local build is out of date . Downloading latest v0.0.27.
                             x avante_html2md.dylib
                             x avante_repo_map.dylib
                             x avante_templates.dylib
                             x avante_tokenizers.dylib
                           ✔ [task] log 88.46ms

charlseo avatar Sep 09 '25 13:09 charlseo

Thanks for this @charlseo , it was my issue too. I thought I'd share what I did to resolve it.

What I was seeing in nvim:

Error detected while processing ModeChanged Autocommands for "<buffer=5>":
Error executing lua callback: ...er/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:280: Make sure to build avante (missing avante_templates)
stack traceback:
[C]: in function 'error'
...r/.local/share/nvim/lazy/avante.nvim/lua/avante/path.lua:278: in function 'get_templates_dir'
...er/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:280: in function 'generate_prompts'
...er/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:500: in function 'calculate_tokens'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2615: in function 'get_generate_prompts_options'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2621: in function 'initialize_token_count'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: in function 'show_input_hint'
...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:3042: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:3042>

Running the build directly gave me the 401 response:

cd ~/.local/share/nvim/lazy/avante.nvim
CURL_VERBOSE=1 LUA_VERSION=luajit BUILD_FROM_SOURCE=true bash ./build.sh
Local build is out of date . Downloading latest v0.0.27.
non-200 OK status code: 401 Unauthorized body: 
"{\"message\":\"This endpoint requires you to be authenticated.\",\"documentation_url\":\"https://docs.github.com/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql\",\"status\":\"401\"}"

I sign into git hub enterprise for work and have not yet signed into github.com on this machine. The solution was to auth with my non ghe account.

# Add authentication for public GitHub while keeping enterprise setup
gh auth login --hostname github.com

# During the interactive prompt:
# 1. Choose your preferred protocol (HTTPS or SSH)
# 2. Complete the authentication process

# Verify both GHE and public GitHub now configured
gh auth status
# Shows both ****.ghe.com and github.com

# Build now succeeds
cd ~/.local/share/nvim/lazy/avante.nvim
LUA_VERSION=luajit BUILD_FROM_SOURCE=true bash ./build.sh

tjmkruger avatar Sep 14 '25 12:09 tjmkruger