# Ocaml platform crashing almost immediately on VSCode startup

**URL:** <https://discuss.ocaml.org/t/ocaml-platform-crashing-almost-immediately-on-vscode-startup/10362>\
**Category:** Learning\
**Tags:** ocaml-lsp-server\
**Created:** [August 24, 2022, 4:04am UTC](https://discuss.ocaml.org/t/ocaml-platform-crashing-almost-immediately-on-vscode-startup/10362 "2022-08-24T04:04:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewblinn](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@andrewblinn](https://discuss.ocaml.org/u/andrewblinn)\
**Post date:** [August 24, 2022, 4:04am UTC](https://discuss.ocaml.org/t/ocaml-platform-crashing-almost-immediately-on-vscode-startup/10362/1 "2022-08-24T04:04:22Z")

</div>

Seems to be throwing an exception in merlin; not sure how to debug this. The below is the complete log for the 10-15 seconds of editing possible before it bails out. This followed upgrading my project to OCaml 4.13.1 (maximum I can currently use due to dependencies)

```auto
/-----------------------------------------------------------------------
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.ECHILD, "waitpid", "")
| Raised by primitive operation at Extend_driver.stop in file "ocaml-lsp-server/vendor/merlin/src/extend/extend_driver.ml", line 45, characters 15-36
| Called from Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 47, characters 18-27
| Re-raised at Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 54, characters 10-26
| Called from Stdlib__Fun.protect in file "fun.ml", line 33, characters 8-15
| Re-raised at Stdlib__Fun.protect in file "fun.ml", line 38, characters 6-52
| Called from Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 18, characters 8-38
| Re-raised at Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 20, characters 42-53
| Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| 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__Core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__Scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-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
\-----------------------------------------------------------------------

[Info - 11:56:01 PM] Connection to server got closed. Server will restart.
/-----------------------------------------------------------------------
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.ECHILD, "waitpid", "")
| Raised by primitive operation at Extend_driver.stop in file "ocaml-lsp-server/vendor/merlin/src/extend/extend_driver.ml", line 45, characters 15-36
| Called from Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 47, characters 18-27
| Re-raised at Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 54, characters 10-26
| Called from Stdlib__Fun.protect in file "fun.ml", line 33, characters 8-15
| Re-raised at Stdlib__Fun.protect in file "fun.ml", line 38, characters 6-52
| Called from Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 18, characters 8-38
| Re-raised at Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 20, characters 42-53
| Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| 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__Core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__Scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-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
\-----------------------------------------------------------------------

[Info - 11:56:02 PM] Connection to server got closed. Server will restart.
[Error - 11:57:05 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:08 PM] Request textDocument/foldingRange failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:09 PM] Request textDocument/documentSymbol failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:10 PM] Request completionItem/resolve failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:10 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:11 PM] Request textDocument/codeLens failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:12 PM] Request textDocument/foldingRange failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:12 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:12 PM] Request completionItem/resolve failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:12 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:12 PM] Request textDocument/completion failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:13 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:13 PM] Request completionItem/resolve failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:13 PM] Request textDocument/foldingRange failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:13 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:13 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:20 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:21 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:21 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:22 PM] Request textDocument/signatureHelp failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:22 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:22 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:27 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:28 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:28 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:29 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:30 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:30 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:30 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:31 PM] Request textDocument/signatureHelp failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:32 PM] Request textDocument/documentSymbol failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:34 PM] Request completionItem/resolve failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:34 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:35 PM] Request textDocument/codeLens failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:35 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:35 PM] Request textDocument/completion failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:35 PM] Request textDocument/signatureHelp failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:35 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:35 PM] Request textDocument/completion failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:36 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:36 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:39 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:40 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
/-----------------------------------------------------------------------
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.ECHILD, "waitpid", "")
| Raised by primitive operation at Extend_driver.stop in file "ocaml-lsp-server/vendor/merlin/src/extend/extend_driver.ml", line 45, characters 15-36
| Called from Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 47, characters 18-27
| Re-raised at Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 54, characters 10-26
| Called from Stdlib__Fun.protect in file "fun.ml", line 33, characters 8-15
| Re-raised at Stdlib__Fun.protect in file "fun.ml", line 38, characters 6-52
| Called from Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 18, characters 8-38
| Re-raised at Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 20, characters 42-53
| Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| 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__Core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__Scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-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
\-----------------------------------------------------------------------

[Info - 11:57:40 PM] Connection to server got closed. Server will restart.
[Error - 11:57:40 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
/-----------------------------------------------------------------------
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.ECHILD, "waitpid", "")
| Raised by primitive operation at Extend_driver.stop in file "ocaml-lsp-server/vendor/merlin/src/extend/extend_driver.ml", line 45, characters 15-36
| Called from Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 47, characters 18-27
| Re-raised at Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 54, characters 10-26
| Called from Stdlib__Fun.protect in file "fun.ml", line 33, characters 8-15
| Re-raised at Stdlib__Fun.protect in file "fun.ml", line 38, characters 6-52
| Called from Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 18, characters 8-38
| Re-raised at Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 20, characters 42-53
| Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| 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__Core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__Scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-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
\-----------------------------------------------------------------------

[Info - 11:57:40 PM] Connection to server got closed. Server will restart.
[Error - 11:57:40 PM] Request textDocument/documentSymbol failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
[Error - 11:57:40 PM] Request textDocument/codeAction failed.
  Message: uncaught exception
  Code: -32603 
[object Object]
/-----------------------------------------------------------------------
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.ECHILD, "waitpid", "")
| Raised by primitive operation at Extend_driver.stop in file "ocaml-lsp-server/vendor/merlin/src/extend/extend_driver.ml", line 45, characters 15-36
| Called from Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 47, characters 18-27
| Re-raised at Merlin_utils__Misc.try_finally in file "ocaml-lsp-server/vendor/merlin/src/utils/misc.ml", line 54, characters 10-26
| Called from Stdlib__Fun.protect in file "fun.ml", line 33, characters 8-15
| Re-raised at Stdlib__Fun.protect in file "fun.ml", line 38, characters 6-52
| Called from Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 18, characters 8-38
| Re-raised at Mocaml.with_state in file "ocaml-lsp-server/vendor/merlin/src/kernel/mocaml.ml", line 20, characters 42-53
| Called from Stdune__Exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| 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__Core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__Scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-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
\-----------------------------------------------------------------------

[Error - 11:57:41 PM] The OCaml Platform VS Code extension server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

```

---

<div class="post-metadata">

**Author:** ![rgrinberg](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/rgrinberg/32/40_2.png) [@rgrinberg](https://discuss.ocaml.org/u/rgrinberg)\
**Post date:** [August 24, 2022, 5:06am UTC](https://discuss.ocaml.org/t/ocaml-platform-crashing-almost-immediately-on-vscode-startup/10362/2 "2022-08-24T05:06:47Z")

</div>

The issue is fixed in later versions of ocamllsp. Unfortunately that requires you to upgrade to 4.14.
