Skip to content

Error: Invalid window id #2859

Closed
Closed
@mikehaertl

Description

@mikehaertl

Description

I get this error when I try to open a file under certain conditions:

Error executing vim.schedule lua callback: ...g/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:172: Invalid window id: 1008
stack traceback:
        [C]: in function 'nvim_set_option_value'
        ...g/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:172: in function 'pick_win_id'
        ...g/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:249: in function 'get_target_winid'
        ...g/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:277: in function 'open_in_new_window'
        ...g/nvim-tree.lua/lua/nvim-tree/actions/node/open-file.lua:400: in function 'fn'
        /tmp/plugged/vim-plug/nvim-tree.lua/lua/nvim-tree/view.lua:532: in function </tmp/plugged/vim-plug/nvim-tree.lua/lua/nvim-tree/view.lua:501>

I'm unsure if nvim-tree is really the root problem. I had to play around a lot to find the minmal set of plugins to reproduce the issue:

  • vim-airline
  • nvim-tre
  • fzf-lua
  • incline.nvim

Neovim version

NVIM v0.10.0
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068

Operating system and version

Linux Mint 21.3

Windows variant

No response

nvim-tree version

48d0e82

Clean room replication

"
" Minimal vim config to reproduce issues without messing with installed plugins.
" Based on https://github.com/hrsh7th/nvim-cmp/blob/main/utils/vimrc.vim
"
" To start vim with this config:
"  vim -u /path/to/minimal-example.vim
"
if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'nvim-tree/nvim-tree.lua'
Plug 'ibhagwan/fzf-lua', { 'branch': 'main' }
Plug 'b0o/incline.nvim'
call plug#end()
PlugInstall | quit

let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
set laststatus=3                " always show the status line

lua << EOF
require('fzf-lua').setup()
require('incline').setup()
require('nvim-tree').setup()
EOF


let mapleader = ','       " Map <leader> to , instead of default \
nmap <leader>t <Cmd>NvimTreeFindFileToggle<CR>
nmap <leader>/ <Cmd>FzfLua live_grep path_shorten=false<CR>

Steps to reproduce

  1. mkdir test && cd test
  2. touch {a,b,c}.txt
  3. echo aaa > a.txt && echo aaa > c.txt
  4. nvim -u /path/to/above/minimal.vim -o a.txt b.txt
  5. Press , + t (to open nvim-tree)

You should now have this condition. Active window must be tree:
image

  1. Now trigger a fzf grep with , + / and enter aaa
    image

  2. Pick file c.txt with <c-j> followed by <CR>

  3. You should get a window selection (A or B).
    image

  4. Press A to select upper window.

Expected behavior

There should be no error

Actual behavior

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions