Skip to content

VS Code extension error Request textDocument/codeAction failed when using dbg #560

@SDepn

Description

@SDepn

I am getting a VS Code error Request textDocument/codeAction failed. whenever I try to put |> dbg behind any kind of function. It does not seem to matter what function it is, it happens every time. I had this in my work project and was able to reproduce it in a test project as well.

For example if I have this code:

  def my_function do
    foo()
  end

As soon as I try to |> dbg behind the foo() function call, I get the error.

This is the log output for the error:

2026-04-08 14:45:54.942 [info] [Info  - 2:45:54 PM] Opened file:///home/<USER>/dev/test_project/lib/test_project/documents.ex
2026-04-08 14:45:54.958 [info] [Info  - 2:45:54 PM] Resolved entity: {:call, Kernel, :defmodule, 2}
2026-04-08 14:45:59.493 [info] [Info  - 2:45:59 PM] Emitting Completions: [:do/end block ]
2026-04-08 14:45:59.713 [info] [Info  - 2:45:59 PM] Completion for XpPos<<104, 54>>
2026-04-08 14:45:59.719 [info] [Warn  - 2:45:59 PM] Unhandled trace event: {:compile_env, :elixir, [:dbg_callback], {:ok, {Macro, :dbg, []}}}
2026-04-08 14:45:59.720 [info] [Warn  - 2:45:59 PM] Unhandled trace event: {:compile_env, :elixir, [:dbg_callback], {:ok, {Macro, :dbg, []}}}
2026-04-08 14:45:59.759 [info] [Info  - 2:45:59 PM] Local completions are: [macro: (dbg, dbg, dbg)   ]
2026-04-08 14:45:59.768 [info] [Info  - 2:45:59 PM] Emitting Completions: [3:dbg() 3:dbg(options) ]
2026-04-08 14:46:00.073 [info] [Info  - 2:46:00 PM] Resolved entity: {:call, Kernel, :dbg, 0}
2026-04-08 14:46:00.260 [info] [Error - 2:46:00 PM] ** (ErlangError) Erlang error: {:exception, :function_clause, [{:lists, :mapfoldl_1, [#Function<20.36417308/2 in Macro>, %{last_line: 104}, nil], [file: ~c"lists.erl", line: 2672]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2674]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2673]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2673]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2674]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}]}
    (kernel 10.2.7.1) erpc.erl:1368: :erpc.call/5
    (xp_expert 0.1.0) lib/expert/provider/handlers/code_action.ex:19: XPExpert.Provider.Handlers.CodeAction.handle/1
    (xp_expert 0.1.0) lib/expert.ex:118: XPExpert.handle_request/2
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:390: anonymous fn/2 in XPGenLSP.loop/3
    (xp_telemetry 1.3.0) /Users/runner/work/expert/expert/apps/expert/deps/telemetry/src/telemetry.erl:324: :xp_telemetry.span/3
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:389: anonymous fn/5 in XPGenLSP.loop/3
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:559: anonymous fn/4 in XPGenLSP.attempt/4
    (elixir 1.17.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
2026-04-08 14:46:00.261 [info] [Error - 2:46:00 PM] ** (ErlangError) Erlang error: {:exception, :function_clause, [{:lists, :mapfoldl_1, [#Function<20.36417308/2 in Macro>, %{last_line: 104}, nil], [file: ~c"lists.erl", line: 2672]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2674]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2673]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2673]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2674]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}]}
    (kernel 10.2.7.1) erpc.erl:1368: :erpc.call/5
    (xp_expert 0.1.0) lib/expert/provider/handlers/code_action.ex:19: XPExpert.Provider.Handlers.CodeAction.handle/1
    (xp_expert 0.1.0) lib/expert.ex:118: XPExpert.handle_request/2
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:390: anonymous fn/2 in XPGenLSP.loop/3
    (xp_telemetry 1.3.0) /Users/runner/work/expert/expert/apps/expert/deps/telemetry/src/telemetry.erl:324: :xp_telemetry.span/3
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:389: anonymous fn/5 in XPGenLSP.loop/3
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:559: anonymous fn/4 in XPGenLSP.attempt/4
    (elixir 1.17.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2

2026-04-08 14:46:00.261 [info] [Error - 2:46:00 PM] Request textDocument/codeAction failed.
2026-04-08 14:46:00.261 [info]   Message: ** (ErlangError) Erlang error: {:exception, :function_clause, [{:lists, :mapfoldl_1, [#Function<20.36417308/2 in Macro>, %{last_line: 104}, nil], [file: ~c"lists.erl", line: 2672]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2674]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2673]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2673]}, {:lists, :mapfoldl_1, 3, [file: ~c"lists.erl", line: 2674]}, {Macro, :do_traverse, 4, [file: ~c"lib/macro.ex", line: 628]}]}
    (kernel 10.2.7.1) erpc.erl:1368: :erpc.call/5
    (xp_expert 0.1.0) lib/expert/provider/handlers/code_action.ex:19: XPExpert.Provider.Handlers.CodeAction.handle/1
    (xp_expert 0.1.0) lib/expert.ex:118: XPExpert.handle_request/2
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:390: anonymous fn/2 in XPGenLSP.loop/3
    (xp_telemetry 1.3.0) /Users/runner/work/expert/expert/apps/expert/deps/telemetry/src/telemetry.erl:324: :xp_telemetry.span/3
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:389: anonymous fn/5 in XPGenLSP.loop/3
    (xp_gen_lsp 0.11.3) lib/gen_lsp.ex:559: anonymous fn/4 in XPGenLSP.attempt/4
    (elixir 1.17.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2

  Code: -32603 
2026-04-08 14:46:03.510 [info] [Info  - 2:46:03 PM] Resolved entity: {:call, Kernel, :dbg, 0}
2026-04-08 14:46:09.367 [info] [Info  - 2:46:09 PM] Compiled test_project in 169 ms

## Specs

IDE: Visual Studio Code (1.114.0)
Installation method: VS Code Extension store
Expert version: v0.1.0
OS: Windows with WSL (project and VS code running in WSL)
OTP / Elixir version: 28.3.1 / 1.19.5 installed with ASDF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions