Skip to content

bug: Switching to ACP provider from other providers not working #2879

@ljie-PI

Description

@ljie-PI

Describe the bug

When I use "copilot" provider and then switch to acp provider "opencode" (using :AvanteSwitchProvider opencode or change the provider in nvim config file), I would get error when sending query again.

I have to remove the history directory in ~/.local/state/nvim/avante/projects and then start neovim again to make the switch work.

To reproduce

Image

Expected behavior

I would expect acp providers can work after the switch.

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 = {
    ---@alias Mode "agentic" | "legacy"
    mode = "agentic",
  
    ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | <acp_provider>
    provider = "opencode",
    providers = {
      copilot = {
        model = "claude-sonnet-4.5",
      },
    },
    acp_providers = {
      ["opencode"] = {
        command = "opencode",
        args = { "acp" },
      },
      ["gemini-cli"] = {
        command = "gemini",
        args = { "--experimental-acp" },
      },
    },
  
    input = {
      provider = "native"
    },
  },
  -- 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-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
  },
}

Environment

❯ nvim -v
NVIM v0.11.4
Build type: Release
LuaJIT 2.1.1753364724
Run "nvim -V1 -v" for more info

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

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions