merlin icon indicating copy to clipboard operation
merlin copied to clipboard

server crashes when handling "workspace/symbol": uncaught exception

Open kentookura opened this issue 1 year ago • 4 comments

When the neovim client executes the "workspace/symbol" request, I get the following error:

Error executing 'workspace/symbol': RPC[Error] code_name = InternalError, message = "uncaught exception", data = {
backtrace = 'Raised at Ocaml_typing__Cmt_format.read.(fun) in file "src/ocaml/typing/cmt_format.ml", line 430, characters 11-69
Called from Merlin_utils__Misc.try_finally in file "src/utils/misc.ml", line 45, characters 8-15
Re-raised at Merlin_utils__Misc.try_finally in file " src/utils/misc.ml", line 62, characters 10-24
Called from Ocaml_typing__Cmt_format.read_cmt in file "src/ocaml/typing/cmt_format.ml", line 436, characters 8-21
Called from Ocaml_lsp_server__Workspace_symbol.symbols_from_cm_file in file "ocaml-lsp-server/src/workspace_symbol.ml", line 252, characters 43-71
Called from Stdune__List.rev_concat_map.aux in file "otherlibs/stdune/src/list.ml", line 54, characters 15-18
Called from Stdune__List.concat_map in file "otherlibs/stdune/src/list.ml" (inlined), line 60, characters 26-47
Called from Ocaml_lsp_server__ Workspace_symbol.run.(fun) in file "ocaml-lsp-server/src/workspace_symbol.ml", line 323, characters 9-79
Called from Stdune__Result.map in file "otherlibs/stdune/src/result.ml", line 45, characters 15-20
Called from Stdlib__List.rev_map.rmap_f in file "list.ml", line 105, charact ers 22-25
Called from Stdune__List.map in file "otherlibs/stdune/src/list.ml" (inlined), line 5, characters 19-33
Called from Ocaml_lsp_server__Workspace_symbol.run in file "ocaml-lsp-server/src/workspace_symbol.ml", lines 315-323, characters 6-81
Called from Stdune__Exn_with_ba cktrace.try_with in file "otherlibs/stdune/src/exn_with_backtrace.ml", line 9, characters 8-12
Re-raised at Stdune__Exn.raise_with_backtrace in file "otherlibs/stdune/src/exn.ml" (inlined), line 38, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file "otherlib s/stdune/src/exn_with_backtrace.ml", line 20, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber/src/scheduler.ml", line 73, characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file "otherlibs/stdune/src/exn.ml" (inlined), line 38, characters 27-56
Ca lled from Stdune__Exn_with_backtrace.reraise in file "otherlibs/stdune/src/exn_with_backtrace.ml", line 20, characters 33-71
Called from Fiber__Scheduler.exec in file "fiber/src/scheduler.ml", line 73, characters 8-11
}

Neovim version: NVIM v0.11.0-nightly+3689082 ocamllsp version: 1.19.0 OS: NixOS 24.11.20241009.5633bcf (Vicuna)

kentookura avatar Oct 28 '24 08:10 kentookura

This looks like there is a mismatch between the version of the OCaml compiler you used to build your project and the version of OCaml you used to build ocaml-lsp-server. You can try to clean and rebuild the project or make sure you have ocaml-lsp installed in the same switch you are using to build the project.

The error message is very bad however, and should be improved, I will move that issue to the Merlin repository.

voodoos avatar Oct 28 '24 10:10 voodoos

Thanks for the hint. I am actually using opam-nix, I will need to see how this can be done.

kentookura avatar Oct 28 '24 10:10 kentookura

@kentookura you might find interesting information in that thread: https://discuss.ocaml.org/t/using-ocaml-lsp-server-with-opam-switches-in-neovim/14428/1 (I didn't read it)

voodoos avatar Oct 28 '24 14:10 voodoos

Thanks, but it seems that this is a very strange bug in opam-nix.

kentookura avatar Oct 28 '24 15:10 kentookura