ElixirLS crashes on launch: (RuntimeError) found error while checking types for ElixirLS.Utils.Launch.start_mix/0

I use Nix to manage my development environment, and after updating the pinned nixpkgs version in a working project, without changing the pinned version of Elixir, ElixirLS started crashing on startup while compiling elixir_ls_utils. Is it likely something wrong with my setup, or is this a bug in ElixirLS?

ElixirLS output
Preferred shell is bash, relaunching
Looking for ASDF install
ASDF not found
Looking for mise executable
which: no mise in ([snip])
mise not found
Looking for rtx executable
which: no rtx in ([snip])
rtx not found
Looking for vfox executable
which: no vfox in ([snip])
vfox not found
Installing ElixirLS release v0.26.2
Running in /path/to/project
==> elixir_ls_utils
Compiling 10 files (.ex)
** (EXIT from #PID<0.95.0>) an exception was raised:
** (RuntimeError) found error while checking types for ElixirLS.Utils.Launch.start_mix/0:

** (FunctionClauseError) no function clause matching in anonymous fn/1 in Module.ParallelChecker.cache_chunk/3
The exception happened while checking this code:

def start_mix() do
case Version.match?(System.version(), "< 1.15.0-dev") do
x when :erlang.orelse(:erlang."=:="(x, false), :erlang."=:="(x, nil)) ->
nil

_ ->
Mix.Local.append_archives()
Mix.Local.append_paths()
end

Mix.start()
true = Mix.Hex.ensure_installed?(false)

case :erlang.function_exported(Hex, :start, 0) do
false -> nil
true -> Hex.start()
end

Mix.env(:dev)
Mix.target(:host)

for env <- ["MIX_ENV", "MIX_TARGET"] do
System.delete_env(env)
end

load_dot_config()
:ok
end

Please report this bug at: https://github.com/elixir-lang/elixir/issues

(elixir 1.17.3) lib/module/parallel_checker.ex:458: anonymous fn({{:elixir_version, 0}, %{sig: {:infer, [{[], %{bitmap: 1}}]}}}) in Module.ParallelChecker.cache_chunk/3
(elixir 1.17.3) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
(elixir 1.17.3) lib/module/parallel_checker.ex:458: Module.ParallelChecker.cache_chunk/3
(elixir 1.17.3) lib/module/parallel_checker.ex:378: Module.ParallelChecker.cache_module/2
(elixir 1.17.3) lib/module/types/of.ex:323: Module.Types.Of.remote/6
(elixir 1.17.3) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir 1.17.3) lib/module/types/of.ex:304: Module.Types.Of.remote/8
(elixir 1.17.3) lib/module/types/expr.ex:333: Module.Types.Expr.of_expr/3```

Elixir version:

Erlang/OTP 27 [erts-15.2.1] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns]

Elixir 1.17.3 (compiled with Erlang/OTP 27)
1 Like

Hello!

Not sure what is the problem here, but indeed it seems to be a version problem.

Can you try to rm -rf .elixir_ls at the root of your project and restart your editor?

1 Like

I find myself deleting the .elixir_ls directory pretty frequently. But still things go south. E.g. I’m only able to command-click thru to a module about half the time.

I had already removed that as well as _build and deps, to be sure no leftover artefacts were causing issues.