Ocaml Platform has crashed 5 times

My Visual Studio Plugin keeps erroring out with the following message:
The language server crashed 5 times in the last 3 minutes

The Visual studio log files has this error:
Internal error: Uncaught exception. | ("Map.add_exn: key already exists", | { key = "/Users/sambhavanand/projects/ocaml/learn_ocaml" }) | Raised at Stdune__Code_error.raise in file "otherlibs/stdune/code_error.ml", line 11, characters 30-62 | Called from Stdlib__Map.Make.update in file "map.ml", line 283, characters 18-28 | Called from Stdlib__List.fold_left in file "list.ml", line 121, characters 24-34 | Called from Ocaml_lsp_server__Dune.poll in file "ocaml-lsp-server/src/dune.ml", line 529, characters 6-298 | Called from Fiber__Core.apply2 in file "src/fiber/core.ml", line 96, characters 6-11 | Re-raised at Stdune__Exn.raise_with_backtrace in file "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56 | Called from Stdune__Exn_with_backtrace.reraise in file "otherlibs/stdune/exn_with_backtrace.ml", line 18, characters 33-71 | Called from Fiber__Scheduler.advance.(fun) in file "src/fiber/scheduler.ml", line 191, characters 2-58 | Called from Fiber.run.loop in file "src/fiber/fiber.ml", line 15, characters 30-61 | Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12

Has anyone experienced this before/know how to deal with this?

I recommend upgrading to a newer version of ocamllsp.

I have the same problem - using 1.11.6. Having to disable lsp, Restart Extension Host then re-enable lsp

That’s not possible because the stacktrace you referred to contains code different than in 1.11.6.

Could you post an updated stacktrace?

Discovered what the problem was - I was using an old workspace with the sandbox definition set as

"settings": {
		"ocaml.sandbox": {
			"kind": "global"
		},
		"makefile.extensionOutputFolder": "./.vscode"
	}

Removing this and being prompted for sandbox settings inserts the following in the workspace file

"settings": {
		"ocaml.sandbox": {
			"kind": "global"
		}
	}

So your statement That’s not possible is completely correct :slight_smile: - thanks for pointing this out!