Skip to content

bug: vim.ui.select called with wrong arguments during OAuth authentication (auth_type = "max") #2994

@Archelyst

Description

@Archelyst

Describe the bug

When using auth_type = "max" for Claude Pro subscription OAuth, the authentication flow calls vim.ui.select with incorrect arguments, passing the callback as the second argument instead of the third.

Expected signature: vim.ui.select(items, opts, on_choice)

Actual call appears to be: vim.ui.select(items, on_choice) -- opts missing, callback in wrong position

This breaks with any vim.ui.select provider:

  • Native Neovim: on_choice: expected function, got nil
  • telescope-ui-select: attempt to index local 'opts' (a function value)
  • snacks.nvim picker: on_choice must be a function

Config:

  {
    provider = "claude",
    providers = {
      claude = {
        endpoint = "https://api.anthropic.com",
        model = "claude-sonnet-4-20250514",
        auth_type = "max",
      },
    },
  }

Stacktrace:

  /avante.nvim/lua/avante/providers/claude.lua:794 in authenticate
  /avante.nvim/lua/avante/providers/claude.lua:188 in setup
  /avante.nvim/lua/avante/providers/init.lua:63 in setup
  /avante.nvim/lua/avante/providers/init.lua:212 in setup
  /avante.nvim/lua/avante/init.lua:503 in setup

The issue is in avante/ui/input/providers/native.lua:20 which calls vim.ui.select — the opts table argument is missing.

To reproduce

Use the config above and start nvim.

Expected behavior

No response

Installation method

Use lazy.nvim:

  {
    "yetone/avante.nvim",
    build = vim.fn.has("win32") ~= 0
            and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
            or "make",
    event = "VeryLazy",
    version = false, -- Never set this value to "*"! Never!
    ---@module 'avante'
    ---@type avante.Config
    opts = {
      -- add any opts here
      -- this file can contain specific instructions for your project
      instructions_file = "avante.md",
      -- for example
      provider = "claude",
      providers = {
        claude = {
          endpoint = "https://api.anthropic.com",
          model = "claude-sonnet-4-20250514",
          timeout = 30000, -- Timeout in milliseconds
          auth_type = "max",
          extra_request_body = {
            temperature = 0.75,
            max_tokens = 20480,
          },
        },
      },
    },
    dependencies = {
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      "HakonHarnes/img-clip.nvim",
      "MeanderingProgrammer/render-markdown.nvim",
    },
  }

Environment

  • Neovim: 0.11+
  • OS: Linux (WSL2)
  • avante.nvim: latest

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalebugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions