Skip to content

bug: LSP assertion failed in sync.lua (compute_end_range) when sending snacks.picker.lines to quickfix #72

Closed

Description

@hoyuzhao

Neovim version (nvim -v)

0.12.0

Operating system/version

Windows11

Describe the bug

Description

When sending the results of snacks.picker.lines (from snacks.nvim) to the quickfix list, quicker.nvim triggers a fatal Neovim LSP assertion error (compute_end_range in sync.lua).

Interestingly, this does not happen when using snacks.picker.grep or Telescope's live_grep. It seems to only occur when searching the current buffer (lines) where the active LSP incremental sync gets confused by the quickfix list update via setqflist.

Error Stack Trace

vim.schedule callback: Vim:Lua callback: ...s/neovim/current/share/nvim/runtime/lua/vim/lsp/sync.lua:225: assertion failed!
stack traceback:
[C]: in function 'assert'
...s/neovim/current/share/nvim/runtime/lua/vim/lsp/sync.lua:225: in function 'compute_end_range'
...s/neovim/current/share/nvim/runtime/lua/vim/lsp/sync.lua:406: in function 'compute_diff'
...rrent/share/nvim/runtime/lua/vim/lsp/_changetracking.lua:106: in function 'incremental_changes'
...rrent/share/nvim/runtime/lua/vim/lsp/_changetracking.lua:314: in function 'send_changes_for_group'
...rrent/share/nvim/runtime/lua/vim/lsp/_changetracking.lua:351: in function 'send_changes'
...p/apps/neovim/current/share/nvim/runtime/lua/vim/lsp.lua:980: in function <...p/apps/neovim/current/share/nvim/runtime/lua/vim/lsp.lua:974>
[C]: in function 'setqflist'
...a/Local/nvim-data/lazy/quicker.nvim/lua/quicker/init.lua:73: in function <...a/Local/nvim-data/lazy/quicker.nvim/lua/quicker/init.lua:70>
stack traceback:
[C]: in function 'setqflist'
...a/Local/nvim-data/lazy/quicker.nvim/lua/quicker/init.lua:73: in function <...a/Local/nvim-data/lazy/quicker.nvim/lua/quicker/init.lua:70>

### What is the severity of this bug?

minor (annoyance)

### Steps To Reproduce

### Steps to Reproduce
1. Open a file with an active LSP server attached.
2. Trigger `Snacks.picker.lines()`.
3. Type something to get search results.
4. Send the results to the quickfix list.
5. The LSP assertion error instantly appears.

### Expected Behavior

The search results from `snacks.picker.lines` should be sent to the quickfix list successfully, and `quicker.nvim` should work smoothly without throwing any LSP assertion errors at the bottom of the screen.

### Minimal example file

_No response_

### Minimal init.lua

```Lua

Additional context

No response

Activity

  1. hoyuzhao commented on Apr 8, 2026

    @hoyuzhao
    Author

    Sorry, submitted by mistake. Closing this

  2. uloco commented on Apr 22, 2026

    @uloco

    @hoyuzhao I am having the same issue... what did you do to solve it?

  3. alcroito commented on Jun 18, 2026

    @alcroito

    In my case the issue was because i had the copilot lsp ( https://github.com/zbirenbaum/copilot.lua ) attaching to the quickfix buffer.
    My LLM couldn't find a clean fix for it, it had to patch both quicker.nvim and add some LspAttach FileType auto commands to detach the lsp from the quickfix buffer.
    I don't think either are up-streamable.

  4. bro69noscope commented on Jul 7, 2026

    @bro69noscope

    having similar error, any snacks picker pipe to qf. Haven't tested much, suppressing seems to keep it working just fine.

  5. uloco commented on Jul 7, 2026

    @uloco

    how can i surpress it?

  6. gabrielgnsilva commented on Jul 31, 2026

    @gabrielgnsilva

    I hit the same stack trace on Neovim 0.12.4 with quicker.nvim, snacks.picker.lines(), and zbirenbaum/copilot.lua.

    In my case the root cause was that Copilot was attaching to the quickfix buffer.

    I confirmed it from inside the quickfix window with:

    :lua vim.print({
      ft = vim.bo.filetype,
      bt = vim.bo.buftype,
      listed = vim.bo.buflisted,
      clients = vim.tbl_map(function(c) return c.name end, vim.lsp.get_clients({ bufnr = 0 })),
      copilot_status = vim.b.copilot_lua_attach_status,
    })

    Output:

    {
      ft = "qf",
      bt = "quickfix",
      listed = false,
      clients = { "copilot" },
      copilot_status = "attached",
    }

    Manually detaching Copilot fixed the sync.lua:225 assertion:

    :lua vim.lsp.buf_detach_client(0, <copilot-client-id>)

    This workaround prevents Copilot from staying attached to qf buffers:

    return {
      -- [...]
      config = function(_, opts)
        -- [...]
    
        require('copilot').setup(opts)
    
        local function detach_copilot_from_qf(bufnr)
          vim.schedule(function()
            if not vim.api.nvim_buf_is_valid(bufnr) then
              return
            end
    
            if
              vim.bo[bufnr].buftype ~= 'quickfix'
              and vim.bo[bufnr].filetype ~= 'qf'
            then
              return
            end
    
            pcall(require('copilot.client').buf_detach_if_attached, bufnr)
    
            local ok, util = pcall(require, 'copilot.util')
            if ok then
              util.set_buffer_attach_status(
                bufnr,
                util.ATTACH_STATUS_MANUALLY_DETACHED
              )
            end
          end)
        end
    
        vim.api.nvim_create_autocmd(
          { 'FileType', 'BufEnter', 'BufWinEnter', 'LspAttach' },
          {
            group = vim.api.nvim_create_augroup(
              'copilot_no_quickfix',
              { clear = true }
            ),
            callback = function(args)
              detach_copilot_from_qf(args.buf)
            end,
          }
        )
    
        -- [...]
      end,
    }

    My guess is that one trigger is a LSP client attaching to the quickfix buffer, then quicker.nvim updates the quickfix list with setqflist, and Neovim LSP incremental sync hits the sync.lua:225 assertion.

    This may be better fixed in copilot.lua, but sharing here in case it helps others debug the same stack trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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