=ERROR REPORT==== 13-May-2026::12:52:14.876489 ===
beam/beam_load.c(150): Error loading module etest:
corrupt atom table
escript: exception error: undefined function etest:main/1
in function escript:run/2 (escript.erl, line 750)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
It depends on what the incompatibility is. The opcode incompatibility happens often enough that we have made the error message better. It is also easy to detect as we never re-use old opcodes so new ones will always be higher. The corrupt atom table has only happened once, so normally the error would mean exactly what it says, that the atom table is corrupt for some reason.
Maybe a better approach would be to embed the version used to compile in the .beam file, and then if it fails to load suggest that maybe the issue is that the beam file is compiled with a too modern compiler. There is already some metadata in the .beam file, it could be that the only thing we need is to extract that when loading to make the error messages nicer.
The reason for the seemlingly corrupt atom table is this pull request for Erlang/OTP 28:
It is unfortunate that we had to fix the length limitation of UTF-8 encoded atoms in this way, but it is extremely unlikely that we will have to do something similar again. So when loading future BEAM files in OTP 28 and later, the nicer message should always be shown. For example, attempting to load a BEAM file using native records in OTP 28 will show this message:
1> l(t).
=ERROR REPORT==== 14-May-2026::03:36:31.420679 ===
beam/beam_load.c(194): Error loading module t:
This BEAM file was compiled for a later version of the runtime system than the current (Erlang/OTP 28).
To fix this, please re-compile this module with an Erlang/OTP 28 compiler or update your Erlang/OTP version.
(Use of opcode 189; this emulator supports only up to 184.)
{error,badfile}
Perhaps in an ideal world the programmer could supply a custom message, to help users know how to upgrade, but I am quite satisfied with this output as it is.