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

x/tools/gopls: neovim vim.lsp.buf.server_ready() crashes gopls server #43462

pohzipohzi opened this issue Jan 2, 2021 · 1 comment

x/tools/gopls: neovim vim.lsp.buf.server_ready() crashes gopls server #43462

pohzipohzi opened this issue Jan 2, 2021 · 1 comment


Copy link

@pohzipohzi pohzipohzi commented Jan 2, 2021

What did you do?

Running neovim's vim.lsp.buf.server_ready() crashes the gopls server. The payload appears to send parameters of unexpected type, causing a panic to happen during interface assertion for nonstandard requests

To reproduce, we can start neovim with this minimal config

call plug#begin()
Plug 'neovim/nvim-lspconfig'
call plug#end()
lua require'lspconfig'.gopls.setup{}

edit a .go file, and run :echo luaeval('vim.lsp.buf.server_ready()'). The result should return true and gopls should crash. We can see Neovim's debug log by running

:tabe `=luaeval('vim.lsp.get_log_path()')`

What did you expect to see?

The server should not panic and should instead return an error

What did you see instead?

Here's the stack trace from neovim:

[ ERROR ] 2021-01-02T07:00:30+0800 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:455 ]	"rpc"	"gopls"	"stderr"	"panic: interface conversion: interface {} is []interface {}, not map[string]interface {}\n\ngoroutine 7457 [running]:\*Server).nonstandardRequest(0xc00010c460, 0xf26b60, 0xc008ee8270, 0xc008cc80a0, 0xf, 0xc99940, 0xc0052262a0, 0x0, 0x0, 0x0, ...)\n\t/home/poh/oss/tools/internal/lsp/server.go:118 +0x745\*Server).NonstandardRequest(0xc00010c460, 0xf26b60, 0xc008ee8270, 0xc008cc80a0, 0xf, 0xc99940, 0xc0052262a0, 0xc0052e2000, 0x0, 0x0, ...)\n\t/home/poh/oss/tools/internal/lsp/server_gen.go:124 +0x77"
[ ERROR ] 2021-01-02T07:00:30+0800 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:455 ]	"rpc"	"gopls"	"stderr"	"\, 0xc008ee8270, 0xc00901a000, 0x7f62703ced40, 0xc008ee80f0, 0x58695eec6, 0x138fa20)\n\t/home/poh/oss/tools/internal/lsp/protocol/protocol.go:74 +0x24a\, 0xc008ee8270, 0xc00901a000, 0x7f62703ced40, 0xc008ee80f0, 0x0, 0x0)\n\t/home/poh/oss/tools/internal/lsp/lsprpc/lsprpc.go:559 +0x452\, 0xc008ee8270, 0xc0052923a0, 0x7f62703ced40, 0xc008ee80f0, 0xc003447fb0, 0x1)\n\t/home/poh/oss/tools/internal/jsonrpc2/handler.go:35 +0xcf\, 0xc008ee8de0, 0xc000756120, 0xf26b60, 0xc008ee8270, 0xc0052923a0, 0x7f62703ced40, 0xc008ee80f0)\n\t/home/poh/oss/tools/internal/jsonrpc2/handler.go:103 +0x86\ncreated by\n\t/home/poh/oss/tools/internal/jsonrpc2/handler.go:100 +0x173\n"

Build info

I am on commit 63754364767c38e3e7b8aa74d2e3b2342e49ee76 master
Copy link

@gopherbot gopherbot commented Jan 2, 2021

Change mentions this issue: internal/lsp: avoid panic during interface assertion

gopherbot pushed a commit to golang/tools that referenced this issue Jan 11, 2021
This change fixes a panic in the non-standard request.

Fixes golang/go#43462

Change-Id: I216a56f96ca6159cb9b102183ba3a3eddd186889
GitHub-Last-Rev: 992e818
GitHub-Pull-Request: #265
Reviewed-by: Peter Weinberger <>
Reviewed-by: Rebecca Stambler <>
Trust: Rebecca Stambler <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants