Error "Module must be purged before deleting" after updating dependencies

Hey there, has anyone encountered an issue when upgrading the dependencies where the mix format command prints out all these errors?
09:36:18.362 [error] Module 'Elixir.Phoenix.HTML.Safe' must be purged before deleting
09:36:18.362 [error] Module 'Elixir.Phoenix.HTML.Safe' must be purged before deleting
09:36:18.376 [error] Module 'Elixir.List.Chars' must be purged before deleting
09:36:18.378 [error] Module 'Elixir.Inspect' must be purged before deleting
09:36:18.418 [error] Module 'Elixir.Enumerable' must be purged before deleting
09:36:18.676 [error] Module 'Elixir.String.Chars' must be purged before deleting
09:36:18.676 [error] Module 'Elixir.String.Chars' must be purged before deleting
09:36:18.362 [error] Module 'Elixir.Phoenix.HTML.Safe' must be purged before deleting
09:36:18.362 [error] Module 'Elixir.Phoenix.HTML.Safe' must be purged before deleting
09:36:18.376 [error] Module 'Elixir.List.Chars' must be purged before deleting
09:36:18.378 [error] Module 'Elixir.Inspect' must be purged before deleting
09:36:18.418 [error] Module 'Elixir.Enumerable' must be purged before deleting
09:36:18.676 [error] Module 'Elixir.String.Chars' must be purged before deleting
09:36:18.676 [error] Module 'Elixir.String.Chars' must be purged before deleting
If i disable the Spark.Formatter plugin in formatter.ex they are gone though. My ash dep was in v3.5.43 so a bit outdated, and this happens when updating all of them
Solution:
tried again today and it is working, idk if thats the reason but had come conflicts in my elixir versions between my terminal/vscode so might have been running in 1.18 actually with the new formatter that requires 1.19 🤔
Jump to solution
13 Replies
Rutgerdj
Rutgerdj4w ago
Im running into the same issue. But im not sure if its caused by the Spark plugin
Ahrou
AhrouOP4w ago
if you comment it out does the issue still happen?
Rutgerdj
Rutgerdj4w ago
It doesn't always happen for me. With and without the plugin
Ahrou
AhrouOP4w ago
the inconsistency is weird 🤔 if you try a clean build is it the same? deleting all deps/build directories
Rutgerdj
Rutgerdj4w ago
After running mix clean it seems to consistently work without issues But im mostly getting the errors in CI, where some things might be compiling in parallel so Im suspecting that to be the issue
ZachDaniel
ZachDaniel4w ago
Hmm....the spark formatter was changed to do a compile step before hand But I have no idea why it would be doing that 🙁
Ahrou
AhrouOP4w ago
Maybe my dev env has some weird configuration? Should i try to make a repro?
frankdugan3
frankdugan34w ago
On Elixir 1.19.2-otp-28, I get that every time I run the formatter. If I do a mix compile --force, it clears it up. I wonder if this could be related to the extended compilation parallelization? Mine's set to use all cores. :thinkies:
ZachDaniel
ZachDaniel4w ago
Could be, yeah
George Guimarães
I've debugged this a bit. I'm on elixir 1.18.4-otp-28. This is due to protocol consolidation. This is happening on CI here and there (because we cache deps and _build). It fails mix format on CI. On my laptop, it doesn't fail mix format, but I can realiably trigger this by having consolidate_protocols: true and then running:
mix clean
mix compile
mix compile
mix format
mix clean
mix compile
mix compile
mix format
yeah, I need to compile twice to trigger it. I'm still debugging it
ZachDaniel
ZachDaniel3w ago
🤔 what on earf
Solution
Ahrou
Ahrou3w ago
tried again today and it is working, idk if thats the reason but had come conflicts in my elixir versions between my terminal/vscode so might have been running in 1.18 actually with the new formatter that requires 1.19 🤔
George Guimarães
yeah, i updated ash and spark with the new versions and everything is working (local and CI) thanks @Zach 🙂

Did you find this page helpful?