Postgrex.Result.__struct__/0 is undefined after elixir and ecto upgrade

After upgrading from elixir 1.8.1 to 1.10.2 and ecto_sql 3.0.5 to 3.3.4, cleaning out _build and compiling I am getting a compile error

Postgrex.Result.__struct__/0 is undefined, cannot expand struct Postgrex.Result. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

in a different file each time.

I can not run mix xref graph since I can not get the first compile. The are 750 files at this point. How can I figure out what if any cycles in modules usage are present? What other things could cause this error?

Did you try deleting both directories – rm -rf deps/ _build/ – and then doing mix do deps.get, compile?

Yes, still no luck

Then I’d guess you also have to do mix deps.update postgrex?

Also make sure you do have a dependency on postgrex in your mix.exs, and that it’s not wildly out of date (check mix hex.outdated if possible).