Sometimes when I am using goto definition I get errors like this one

E5108: Error executing lua: ...t_nvimeitLsr/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1964: Invalid window id: 1000
stack traceback:
	[C]: in function 'nvim_win_get_buf'
	...t_nvimeitLsr/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1964: in function 'make_position_params'
	...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:147: in function 'v'
	...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:391: in function 'v'
	.../nvim/lazy/telescope.nvim/lua/telescope/builtin/init.lua:541: in function 'lsp_definitions'
	/home/user/.config/nvim/lua/user/plugins/ide/lspconfig.lua:80: in function 

What could be the cause of an error like this? Whenever this happens I have to restart nvim.

the config in lspconfig.lua:79 looks like this:

        opts.desc = "LSP: Jump to definition of symbol"
        keymap.set("n", "gd", function()
          telescope.lsp_definitions(ivy)
        end, opts)

Any ideas?