Missing Field Postion in request "textDocument/definition"
Describe the Bug
When using lsp server in neovim 11.2, the lsp request seems not handle proply
[ERROR][2025-07-27 16:07:14] ...p/_transport.lua:36 "rpc" "pyrefly" "stderr" 'ERROR Thread panicked, shutting down: panicked at pyrefly/lib/lsp/server.rs:1870:13:\nInvalid request\n method: textDocument/definition\n error: missing field `position`\n request: Request { id: RequestId(I32(3)), method: "textDocument/definition", params: Object {"textDocument": Object {"uri": String("file:///home/jingyan/Desktop/python-test/a.py")}} }\n\nBacktrace:\n 0: <unknown>\n 1: <unknown>\n 2: <unknown>\n 3: <unknown>\n 4: <unknown>\n 5: <unknown>\n 6: <unknown>\n 7: <unknown>\n 8: <unknown>\n 9: <unknown>\n 10: <unknown>\n 11: <unknown>\n 12: <unknown>\n 13: <unknown>\n 14: <unknown>\n 15: <unknown>\n 16: __libc_start_call_main\n at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n 17: __libc_start_main_impl\n at ./csu/../csu/libc-start.c:360:3\n 18: <unknown>\n\nPANIC Sorry, Pyrefly crashed, this is always a bug in Pyrefly itself.\nPANIC Please report the bug at https://github.com/facebook/pyrefly/issues/new\n'
This error occur whenever the lsp start And could be temporarily fix by disable the definitionProvider capaility
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
neovim v0.11.1 pyrefly v-.25.1
Thanks for the report! The textDocument/definition request does require a position field, so it's curious that neovim did not send one. That said, we certainly should not panic when this happens!
@connernilsen have you seen this before (you use neovim)? I think the actual fix for this would be to get neovim to send a position. Without position, how will we know where to resolve the definition from?
I was having the same problem with other LSPs too, and I figured out it was caused by dropbar.nvim. Going back to an older version fixed it for me.
Thank you, I can confirm that the drop bar has sent the wrong lsp request maybe we need an issue there.
after 87fa90821f40ff736c6430658d8102f9737d924a, we will no longer panic if this happens. instead we will respond with an Error via LSP so the other requests still work