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

bug: cursor_applying_provider attempts to call 'parse_curl_args', a nil value.

Open twilwa opened this issue 8 months ago • 10 comments

Describe the bug

...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:326: attempt to call method 'parse_curl_args' (a nil value) stack traceback: ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:326: in function '_stream' ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:774: in function 'stream' ...al/share/nvim/lazy/avante.nvim/lua/avante/suggestion.lua:137: in function 'suggest' ...al/share/nvim/lazy/avante.nvim/lua/avante/suggestion.lua:505: in function 'func' ...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:617: in function <...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:616> ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:326: attempt to call method 'parse_curl_args' (a nil value) stack traceback: ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:326: in function '_stream' ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:774: in function 'stream' ...al/share/nvim/lazy/avante.nvim/lua/avante/suggestion.lua:137: in function 'suggest' ...al/share/nvim/lazy/avante.nvim/lua/avante/suggestion.lua:505: in function 'func' ...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:617: in function <...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:616> function: builtin#18 true ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:326: attempt to call method 'parse_curl_args' (a nil value) stack traceback: ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:326: in function '_stream' ...on/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:774: in function 'stream' ...al/share/nvim/lazy/avante.nvim/lua/avante/suggestion.lua:137: in function 'suggest' ...al/share/nvim/lazy/avante.nvim/lua/avante/suggestion.lua:505: in function 'func' ...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:617: in function <...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:616> 1 change; before #305 3 seconds ago

I checked the codebase and the provider does seem to have the method, so not sure what's going on.

To reproduce

See the repro.lua below, I couldn't get it to load though. From normal config: Set your cursor_applying_provider to any provider (tested w groq and openai) Start typing in insert mode. The above error appears once avante starts trying to predict the cursor.

Expected behavior

The cursor movement is predicted successfully.

Installation method

Note: this kept complaining about plenary so I couldn't get it to load, I think I did it right? Not sure though.

Use lazy.nvim:

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",
      version = false, -- Never set this value to "*"! Never!
      opts = {
        -- add any opts here
        -- for example

        cursor_applying_provider = "groq",

        groq = {
          api_key_name = "GROQ_API_KEY",
          endpoint = "https://api.groq.com/openai/v1/",
          model = "llama-3.3-70b-versatile",
          max_completion_tokens = 128000,
          -- max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models)
          --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models
        },
        vendors = {
          groq = {
            __inherited_from = "openai",
            api_key_name = "GROQ_API_KEY",
            endpoint = "https://api.groq.com/openai/v1/",
            model = "llama-3.3-70b-versatile",
            max_completion_tokens = 128000,
          },
        },
        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.11.0-dev-1295+gbf5c1346c5 Build type: RelWithDebInfo LuaJIT 2.1.1732813678 Run "nvim -V1 -v" for more info

Darwin anons-MacBook-Pro.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6031 arm64

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

twilwa avatar Mar 31 '25 19:03 twilwa

I'm having a similiar problem with the aihubmix provider this is the error message:

E5108: Error executing lua: ...ar/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:336: attempt to call method 'parse_curl_args' (a nil value)
stack traceback:
	...ar/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:336: in function '_stream'
	...ar/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:785: in function 'stream'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2847: in function 'cb'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2582: in function 'get_generate_prompts_options'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2814: in function 'handle_submit'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2901: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2884>

This is my config:

			"yetone/avante.nvim",
			event = "VeryLazy",
			version = false, -- Never set this value to "*"! Never!
			opts = {
				-- 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, increase this for reasoning models
				-- 	temperature = 0,
				-- 	max_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models)
				-- 	--reasoning_effort = "medium", -- low|medium|high, only used for reasoning models
				-- },
				provider = "aihubmix",
				aihubmix = {
					model = "gpt-4o-2024-11-20",
				},
			},
			-- 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,
				"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
				"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" },
				},
			},

ghost avatar Apr 02 '25 17:04 ghost

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 May 03 '25 02:05 github-actions[bot]

Issue still persists for me, currently affecting inline editing and cursor applying.

twilwa avatar May 03 '25 02:05 twilwa

‌‌The latest version no longer has the cursor_planning mode.

yetone avatar May 03 '25 06:05 yetone

‌‌‌‌‌‌‌The latest version should no longer have this issue, please help check it.

yetone avatar May 06 '25 17:05 yetone

Still seeing the same issue, sorry about the screenshot...

Image

jkogara avatar May 09 '25 21:05 jkogara

Same here. Any solutions to resolve this?

jaak-s avatar May 10 '25 14:05 jaak-s

I found the root cause for me at least. I had vendors inside the opts section instead of at the top level of the config.

jkogara avatar May 18 '25 14:05 jkogara

Can you give an example of a working avante.lua config? Thx!

jaak-s avatar May 18 '25 21:05 jaak-s

Sure - https://github.com/jkogara/dotfiles/blob/master/config/nvim/lua/jkogara/lazy/avante.lua

jkogara avatar May 19 '25 06:05 jkogara

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 Jun 20 '25 02:06 github-actions[bot]

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

github-actions[bot] avatar Jun 26 '25 02:06 github-actions[bot]