Skip to content

Conversation

@dorian-marchal
Copy link
Contributor

@dorian-marchal dorian-marchal commented Jan 13, 2026

Related issue: #1403

Problem

On Elixir 1.19+, inspecting an Absinthe.Resolution struct crashes with:

** (FunctionClauseError) no function clause matching in Inspect.Algebra.concat/2

This is caused by a breaking change in Elixir 1.19 where Inspect.List.inspect/2 now returns a tuple {doc, opts} instead of just a document. The current implementation passes this tuple directly to concat/1, which expects a valid document.

Solution

Replace Inspect.List.inspect(opts) with Inspect.Algebra.to_doc(opts).

Changes

  • lib/absinthe/resolution.ex: Updated the Inspect protocol implementation to use to_doc/2 instead of Inspect.List.inspect/2

Fixes #1403


Co-authored by Augment Code

@cschiewek cschiewek changed the title Fix Inspect implementation for Absinthe.Resolution on Elixir 1.19+ fix: Inspect implementation for Absinthe.Resolution on Elixir 1.19+ Jan 13, 2026
@cschiewek
Copy link
Member

@dorian-marchal Can you please address the CI failures. I'm happy to review and potentially merge once CI passes.

@dorian-marchal
Copy link
Contributor Author

@cschiewek thanks, not sure how to fix this: https://github.com/absinthe-graphql/absinthe/actions/runs/20960390649/job/60235699604?pr=1409

Run mix dialyzer
Finding suitable PLTs
Checking PLT...
[:absinthe, :crypto, :dataloader, :decimal, :elixir, :ex_unit, :kernel, :logger, :mix, :nimble_parsec, :opentelemetry_process_propagator, :stdlib, :telemetry]
PLT is up to date!
No :ignore_warnings opt specified in mix.exs. Using default: .dialyzer_ignore.exs.

Starting Dialyzer
[
  check_plt: false,
  init_plt: ~c"/home/runner/work/absinthe/absinthe/priv/plts/project.plt",
  files: [~c"/home/runner/work/absinthe/absinthe/_build/test/lib/absinthe/ebin/Elixir.Absinthe.Middleware.PassParent.beam",
   ~c"/home/runner/work/absinthe/absinthe/_build/test/lib/absinthe/ebin/Elixir.Inspect.Absinthe.Blueprint.Schema.ObjectTypeDefinition.beam",
   ~c"/home/runner/work/absinthe/absinthe/_build/test/lib/absinthe/ebin/Elixir.Absinthe.Phase.Document.Complexity.Analysis.beam",
   ~c"/home/runner/work/absinthe/absinthe/_build/test/lib/absinthe/ebin/Elixir.Absinthe.Fixtures.Directive.TestSchemaArgDescriptionKeyword.Compiled.beam",
   ~c"/home/runner/work/absinthe/absinthe/_build/test/lib/absinthe/ebin/Elixir.Absinthe.Utils.Render.beam",
   ...],
  warnings: [:unknown]
]
:dialyzer.run error: Old PLT file /home/runner/work/absinthe/absinthe/priv/plts/project.plt

Halting VM with exit status 1
Error: Process completed with exit code 1.

@dorian-marchal dorian-marchal marked this pull request as draft January 13, 2026 14:45
@dorian-marchal dorian-marchal marked this pull request as ready for review January 13, 2026 14:45
@dorian-marchal dorian-marchal force-pushed the fix-inspect-elixir-1.19 branch from abf789e to d3d0665 Compare January 13, 2026 14:45
In Elixir 1.19+, Inspect.List.inspect/2 returns a tuple {doc, opts}
instead of just a document. This caused a crash when inspecting
Absinthe.Resolution structs.

Replace Inspect.List.inspect/2 with Inspect.Algebra.to_doc/2, which
is the recommended way to convert any term to an inspect document
and works correctly across all Elixir versions.

Fixes absinthe-graphql#1403
@dorian-marchal dorian-marchal force-pushed the fix-inspect-elixir-1.19 branch from d3d0665 to 6a76882 Compare January 20, 2026 12:19
@dorian-marchal
Copy link
Contributor Author

dorian-marchal commented Jan 20, 2026

Hey @cschiewek,

I looked into the Dialyzer failure and it seems unrelated to my changes: the error Old PLT file usually means the cached PLT was built with a different Erlang/OTP version than what's running now.

Would you be able to clear the Actions cache for the PLT files?

Edit: here is an other merge request with the same CI fail but no code change: #1410

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.

Inspect.Error when inspecting Absinthe.Resolution struct (Elixir 1.19+ / OTP 28)

2 participants