FunctionClauseError on running mix (no function clause matching in OptionParser.validate_swit)

when i tried to run mix

** (FunctionClauseError) no function clause matching in OptionParser.validate_switch/1

The following arguments were given to OptionParser.validate_switch/1:

    # 1

Attempted function clauses (showing 1 out of 1):

    defp validate_switch({_name, type_or_type_and_modifiers})

(elixir 1.13.4) lib/option_parser.ex:623: OptionParser.validate_switch/1
(elixir 1.13.4) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
(elixir 1.13.4) lib/option_parser.ex:599: OptionParser.build_config/1
(elixir 1.13.4) lib/option_parser.ex:231: OptionParser.parse/2
(rustler 0.22.2) lib/mix/tasks/
(mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.4) lib/mix/cli.ex:84: Mix.CLI.run_task/2

@JILL24 This is a bug that was fixed in Rustler 0.23:

1 Like

are you calling mix with any arguments?

no, i am not

You are on an older version of Rustler (0.22.2) where the mix task appears incompatible with Elixir 1.13. See the changelog, specifically a fix in 0.23.0

Assuming you’re on Elixir 1.13, if you upgrade Rustler in your mix.exs {:rustler, "~> 0.25.0"} and run mix deps.update --all, then it should work

1 Like

i can not update rustler 0.22.2 to 0.22.5 because sorted_set_nif require version 0.22.2.
can you tell me what should i have to do?

what version of sorted_set_nif are you on? I just did a fresh install of 1.0.0 and Rustler 0.25.0 was installed. the latest version is 1.2.0 so perhaps update your mix.exs with {:sorted_set_nif, "~> 1.2"} and run mix deps.update sorted_set_nif rustler

If upgrading the dependency doesn’t work then downgrading Elixir to 1.12 will

ok thank you

Hi @JILL24 - welcome to the Elixir forum!

We (the moderators) combined your posts into a single new thread as duplicate posting is against the forum rules.

In addition, consider opening a new thread when asking a mostly-unrelated question. The “mark as answered” feature doesn’t work if you add a new question to a months-old answered one.

1 Like