FunctionClauseError on mix deps.get

Recently, I’m working on a Elixir OTP 26 project.

When I typed in the command `mix deps.get`, I got this error message:

** (FunctionClauseError) no function clause matching in String.Chars.Hex.Solver.Constraints.Range."-inlined-__impl__/1-"/1    
    
    The following arguments were given to String.Chars.Hex.Solver.Constraints.Range."-inlined-__impl__/1-"/1:
    
        # 1
        :target
    
    (hex 2.2.2) String.Chars.Hex.Solver.Constraints.Range."-inlined-__impl__/1-"/1
    (elixir 1.15.7) lib/string/chars.ex:3: String.Chars.impl_for/1
    (elixir 1.15.7) lib/string/chars.ex:3: String.Chars.impl_for!/1
    (elixir 1.15.7) lib/string/chars.ex:22: String.Chars.to_string/1
    (hex 2.2.2) lib/hex/mix.ex:205: Hex.Mix.registry_dep_to_def/1
    (elixir 1.15.7) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
    (hex 2.2.2) lib/hex/mix.ex:157: anonymous fn/1 in Hex.Mix.to_lock/1
    (elixir 1.15.7) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2

I can’t upgrade Erlang and Elixir to OTP 27 or higher because of the `:amqp` lib that constantly throws errors on higher OTP version.

This error is thrown even after I completely deleted the _build and the deps folders. Any help?

OS: Pop!_OS 22.04

Elixir: 1.15.7-otp-26

Erlang: 26.2.5.12

That’s code (a protocol implementation) by hex, not elixir itself:

You could try downgrading hex using mix local.hex [version]

1 Like

Thank you so much! I downgraded hex from 2.2.2 to 2.2.1, and the error is gone.

Please also report the issue, so it can be fixed.

Issue reported. But it’s strange that the said file has not been changed from v2.2.1 to v2.2.2.