Compile Error when defining a Protocol

I created a protocol. Things compiled.

I renamed the protocol from OAuthProvider to OAuth and now it will not compile.

** (EXIT from #PID<0.70.0>) an exception was raised:
    ** (CaseClauseError) no case clause matching: {:error, :not_a_protocol}
        (mix) lib/mix/tasks/compile.protocols.ex:125: Mix.Tasks.Compile.Protocols.consolidate/4
        (elixir) lib/task/supervised.ex:85: Task.Supervised.do_apply/2
        (elixir) lib/task/supervised.ex:36: Task.Supervised.reply/5
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

23:39:14.140 [error] Task #PID<0.205.0> started from #PID<0.70.0> terminating
** (CaseClauseError) no case clause matching: {:error, :not_a_protocol}
    (mix) lib/mix/tasks/compile.protocols.ex:125: Mix.Tasks.Compile.Protocols.consolidate/4
    (elixir) lib/task/supervised.ex:85: Task.Supervised.do_apply/2
    (elixir) lib/task/supervised.ex:36: Task.Supervised.reply/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Function: #Function<8.61154972/0 in Mix.Tasks.Compile.Protocols.consolidate/6>
    Args: []
1 Like

Paste your code and we will see what happens there :slight_smile:

2 Likes

I just figured it out,

deleting _build dir and recompile, everything is fine. :joy:

3 Likes

If you have a mechanism to reproduce this, please let us know, because it is not supposed to happen. :slight_smile:

2 Likes

I will try to reproduce it tonight

1 Like

I just tried to reproduce it quickly but compiled fine.

I made more changes the first time, like changing the implementations at the same time (and before and after) renaming, etc. so that might have made a difference ¯_(ツ)_/¯ or maybe it was a fluke

1 Like

Thanks for double checking.

1 Like

This is quite old, but I found this thread when debugging a very similar error that popped up with Elixir 1.10.1… it seems to only happen when I try to compile using the version installed via Homebrew. Compiling inside of a Docker container works fine. Here’s a sample app that reproduces the behavior: https://github.com/fireproofsocks/bad_compile