expert icon indicating copy to clipboard operation
expert copied to clipboard

FunctionClauseError exception during completion

Open sysashi opened this issue 1 month ago • 0 comments

After a while, during working a codebase in helix I start getting weird behaviour:

  • Formatter sometimes puts parenthesis () in a middle of function name
  • LSP server completely breaks and I see a lot of logs like these
2025-11-19T06:14:22.116 helix_term::handlers::completion::request [ERROR] completion request failed: protocol error: InternalError: ** (FunctionClauseError) no function clause matching in anonymous fn/2 in XPForge.Ast.Analysis.analyze_node/2
    (xp_forge 0.1.0-d80afb1) lib/forge/ast/analysis.ex:323: anonymous fn({:__cursor__, [_scope_id: 7396747639221383194, closing: [line: 24, column: 18], line: 24, column: 7], []}, %XPForge.Ast.Analysis.State{document: #XPForge.Document<path: "path-was-here", version: 2383, dirty?: true, lines: %Lines<"defmodule FV.Search do..."(63 lines)>, ...>, scopes: [%XPForge.Ast.Analysis.Scope{id: 7396747639221383168, range: XpRange[<<1, 23>>...<<24, 20>>], module: [:FV, :Search], aliases: [%XPForge.Ast.Analysis.Alias{module: [:FV, :Search, :ActivityFilters], as: :ActivityFilters, range: XpRange[<<22, 3>>...<<24, 20>>], explicit?: true}, %XPForge.Ast.Analysis.Alias{module: [:FV, :Community, :ClubActivity], as: :ClubActivity, range: XpRange[<<20, 3>>...<<20, 34>>], explicit?: true}, %XPForge.Ast.Analysis.Alias{module: [:FV, :Activities, :AllocatedSlot], as: :AllocatedSlot, range: XpRange[<<15, 3>>...<<18, 4>>], explicit?: true}, %XPForge.Ast.Analysis.Alias{module: [:FV, :Activities, :ActivityInstance], as: :ActivityInstance, range: XpRange[<<15, 3>>...<<18, 4>>], explicit?: true}, %XPForge.Ast.Analysis.Alias{module: [:FV, :Accounts, :Scope], as: :Scope, range: XpRange[<<13, 3>>...<<13, 26>>], explicit?: true}, %XPForge.Ast.Analysis.Alias{module: [:FV, :Repo], as: :Repo, range: XpRange[<<11, 3>>...<<11, 16>>], explicit?: true}, %XPForge.Ast.Analysis.Alias{module: [:FV, :Search], as: :__MODULE__, range: XpRange[<<1, 22>>...<<1, 22>>], explicit?: false}, %XPForge.Ast.Analysis.Alias{module: [:FV], as: :FV, range: XpRange[<<1, 22>>...<<1, 22>>], explicit?: false}], imports: [%XPForge.Ast.Analysis.Import{module: [:Ecto, :Query], selector: :all, range: XpRange[<<9, 3>>...<<9, 20>>], explicit?: true}], requires: [], uses: []}, %XPForge.Ast.Analysis.Scope{id: :global, range: XpRange[<<1, 1>>...<<64, 1>>], module: [], aliases: [%XPForge.Ast.Analysis.Alias{module: [:FV], as: :FV, range: XpRange[<<1, 22>>...<<1, 22>>], explicit?: false}], imports: [], requires: [], uses: []}], visited: %{}}) in XPForge.Ast.Analysis.analyze_node/2
    (elixir 1.17.3) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
    (xp_forge 0.1.0-d80afb1) lib/forge/ast/analysis.ex:133: anonymous fn/2 in XPForge.Ast.Analysis.traverse/2
    (elixir 1.17.3) lib/macro.ex:639: anonymous fn/4 in Macro.do_traverse_args/4
    (stdlib 6.2.2.1) lists.erl:2343: :lists.mapfoldl_1/3
    (stdlib 6.2.2.1) lists.erl:2344: :lists.mapfoldl_1/3
    (elixir 1.17.3) lib/macro.ex:604: Macro.do_traverse/4
    (elixir 1.17.3) lib/macro.ex:619: Macro.do_traverse/4

Anything I can do to help diagnose it further? or maybe it's a misconfiguration on my part

sysashi avatar Nov 19 '25 03:11 sysashi