Dialyzer: inferring types when using Mox

I have a similar issue, but it’s actually the other way around. There is a client with a stubbed implementation or a real one being chosen at compile time. The stub is for testing/dev and always succeeds returning an {:ok, Res} tuple. The real implementation may fail with {:error, Error}. Since Dialyzer is run with the :test env, it returns The pattern can never match the type. in places in which the caller handles error return values. I want to avoid running Dialyzer in :prod env, and I’m not sure how to deal with this issue.