TIL that, when upgrading Mastodon, when this command for asset compilation fails:
RAILS_ENV=production bundle exec rails assets:precompile
If you run it again and it says everything’s OK, it’s a lie.
You need to delete the failed compiled assets, and start fresh. In order to do that, use the command:
RAILS_ENV=production bundle exec rails assets:clobber
And then you can try again the precompile action.
Apparently, this action uses a lot of RAM. If it keeps failing, you may want to consider stopping some processes (including Mastodon) and trying again.