Skip to content

bug: unhandled promise rejection when trying to open results from trouble #672

Description

@skoch13

Did you check docs and existing issues?

  • I have read all the trouble.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of trouble.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

nightly

Operating system/version

MacOS 26.1

Describe the bug

Say I make a grep and sending search results to trouble. Iterating over a search result element fails with:

  Error  12:26:32 notify.error Trouble Unhandled promise rejection:
```lua
...l/share/nvim/lazy/trouble.nvim/lua/trouble/view/init.lua:287: Cursor position outside buffer

stack traceback:
	...cal/share/nvim/lazy/trouble.nvim/lua/trouble/promise.lua:34: in function 'transition'
	...cal/share/nvim/lazy/trouble.nvim/lua/trouble/promise.lua:48: in function 'reject'
	...cal/share/nvim/lazy/trouble.nvim/lua/trouble/promise.lua:81: in function <...cal/share/nvim/lazy/trouble.nvim/lua/trouble/promise.lua:67>```

My assumption is that it might be related to git worktrees, but I'm not sure. Opening the same search in quickfix works as expected.

Steps To Reproduce

  1. Search for something with live_grep (snacks)
  2. press <a-t>
  3. trying to navigate within search results with [q

Expected Behavior

The resulting buffer is open

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 = {
    { "folke/trouble.nvim", opts = {} },
    -- 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