Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: error regarding "ModeChanged" autocommands #1014

Open
synic opened this issue Dec 31, 2024 · 1 comment
Open

bug: error regarding "ModeChanged" autocommands #1014

synic opened this issue Dec 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@synic
Copy link

synic commented Dec 31, 2024

Describe the bug

Changing window focus between avante and other buffers causes the error below. Once it gets in this state, you have to close avante completely and re-open it, because you'll get the error for every key you press.

Error detected while processing ModeChanged Autocommands for "*:i":
Error executing lua callback: deserialize error: missing field `ask`
stack traceback:
        [C]: in function 'render_mode'
        ...ic/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:58: in function 'generate_prompts'
        ...ic/.local/share/nvim/lazy/avante.nvim/lua/avante/llm.lua:120: in function 'calculate_tokens'
        ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:1856: in function 'show_hint'
        ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:1911: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:1909>

To reproduce

Ok, to reproduce this, you have focus in the ask window. Then, exit insert mode, type <c-w>h to move your cursor to the window on the left. Then type <c-w>l, and <c-w>j (may need a few times to get down to the ask window).

When the cursor gets back to the ask window, you will get this error.

It doesn't matter how you get back to the window, just moving the cursor to a non-avante window and back to the ask window will cause breakage.

Expected behavior

This should not happen.

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

:version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1732813678
Run ":verbose version" for more info

On macos 15.2, and I am using Claude

Repro

No response

@synic synic added the bug Something isn't working label Dec 31, 2024
@Jinbiao-Lin
Copy link

I have the issue too. By the way, I'm using tmux. When switching back from another tmux session, the error will pop up. I need to press enter multiple Times.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants