Function Mox.__dispatch__/4 does not exist Dialyzer

I followed this instructions to add CI to my project using github actions. But Dialyzer is not happy, and I don’t understand why:

:0:unknown_function
Function Mox.__dispatch__/4 does not exist.

Full log available: https://github.com/brianmay/lifx/runs/716191274

This works when I test it locally.

The obvious reason, Mox is not installed, looks wrong, because I clearly see it being installed:

[...]
Unchanged:
  bunt 0.2.0
  credo 1.4.0
  dialyxir 1.0.0
  earmark 1.4.4
  erlex 0.2.6
  ex_doc 0.22.1
  jason 1.2.1
  makeup 1.0.1
  makeup_elixir 0.14.0
  mox 0.5.2
[...]

Any other ideas?

Looking at you dependencies Mox is only available at :test ENV, could this cause the trouble?

1 Like

Are you sure you are looking at the correct branch (workflows)? Looks fine to me:

      {:mox, "~> 0.5", only: [:dev, :test]}

Submitted a PR:

Generally you should not set applications, but instead extra_applications. Otherwise you need to list all of your applications, as well as all your dependencies applications, and your dependencies dependencies, etc.

That worked, thanks!

1 Like

Glad to help!

No, direct dependencies are enough. No need to get transient dependencies into the list, as they all have their own :applications which will be considered when packaging and building the application start order.

1 Like

I see https://www.amberbit.com/blog/2017/9/22/elixir-applications-vs-extra_applications-guide/ which explains the difference between applications and extra_applications. I agree extra_applications was the correct one to use. Although for this simply library, it mostly didn’t matter.

I still don’t understand why this mattered here for dialyzer however. dialyzer seemed to be complaining that Mox couldn’t be found. Not that Mox wasn’t actually started. In fact does dialyzer even need to start apps to work correctly? I would have thought not.