Skip to content

Fix SystemLimitError in multialias lookups for long aliases - #1286

Merged
lukaszsamson merged 1 commit into
masterfrom
fix-definition-long-alias-system-limit
Oct 18, 2026
Merged

lukaszsamson merged 1 commit into
masterfrom
fix-definition-long-alias-system-limit

Conversation

@lukaszsamson

Copy link
Copy Markdown
Collaborator

Summary

Fixes a SystemLimitError crash in go-to-definition (and the same pattern in hover and references) when the cursor is on a multi-alias segment (Outer.{Inner}) and the combined module name exceeds the 255-character atom limit.

Crash report (Elixir 1.18.4, atom shortened):

** (SystemLimitError) a system limit has been reached
    :erlang.binary_to_atom("Elixir.Orchestrator.Core.Schemas.BmcOdDCU8I8b7tySJ8...", :utf8)
    (elixir 1.18.4) :elixir_aliases.concat/1
    language_server/providers/definition/locator.ex:134: ElixirLS.LanguageServer.Providers.Definition.Locator.find/3
    language_server/providers/definition/locator.ex:17: ElixirLS.LanguageServer.Providers.Definition.definition/5

Changes

  • providers/definition/locator.ex, providers/references/locator.ex, providers/hover/docs.ex: the three Module.concat calls in the multi-alias branch now go through a private concat_aliases/1 helper that rescues SystemLimitError and returns nil. Callers skip the lookup on nil (definition and hover return nil, references returns []).
  • test/providers/definition/locator_test.exs: regression test with a long combined alias under a multi-alias. Verified it fails with SystemLimitError on the previous code.

Implementation and completion providers do not have this pattern.

Module.concat/1 raises SystemLimitError when the combined module name
exceeds the 255 character atom limit. The multialias branches in the
definition, references and hover providers (`Outer.{Inner}`) called
Module.concat directly, so a long combined alias crashed the request.

Add a private concat_aliases/1 helper that rescues SystemLimitError and
returns nil; the call sites return no result (nil, or [] for references)
in that case.
@lukaszsamson
lukaszsamson merged commit 1d45cf7 into master Oct 18, 2026
23 checks passed
@lukaszsamson
lukaszsamson deleted the fix-definition-long-alias-system-limit branch October 18, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant