BEAM :badfile after updating to Phoenix 1.5.4

I have an annoying problem. My application still runs, but my dev log is lit up like a Christmas tree when executed. I’ve spent far too long trying to research this, but I’ve not come up with anything particularly relevant. So here I am.

After I did a mix deps.update for my project – I wanted the latest live view changes – I started getting all sorts of BEAM errors. All of them variations of a theme:

Loading of ********/_build/dev/lib/rconlive/ebin/Elixir.RconliveWeb.UserSocket 3.beam failed: :badfile

Loading of module after module suffixed with an integer failed with :badfile.

PageController 3.beam failed: :badfile
[error] beam/beam_load.c(1440): Error loading module ‘Elixir.RconliveWeb.PageView 3’:
BEAM file exists but it defines a module named Elixir.RconliveWeb.PageView

Mix deps.clean --all, then I started over. Compiled everything fresh in case something went out of sync for some reason. Same errors. Using asdf, I updated my elixir and Erlang builds to their latest incarnations. This fixed the problem momentarily, but within a few hours, after a couple of restarts of the process, the :badfile errors were back.

I admit I’m still an elixir newb, and the app still runs. But has anyone had an experience like this? What am I missing? What should I try to clean this mess up and stop these BEAM errors from flying around?

Seeing as you have repeated module files (“Module X.beam” where X is a number), could you be having the same issue as this poster? Error module name in object code is Elixir – Remember to check the solution post, it’s linked at the end of the first post. For that user it was an issue with iCloud multiplying the BEAM files.

Thanks for that! I didn’t find that on a search. I appreciate you pointing it out to me.

1 Like