mattmower

mattmower

I’ve just updated an escript based application of mine from Elixir 1.17 to 1.19.

At the same time I attempted to update from OTP 27.2.2 to 28.1.1

After switching to 1.19.3-otp28, nuking the _build folder, and recompiling, the escript binary gives the following error:

=ERROR REPORT==== 20-Nov-2025::14:32:27.189484 ===
beam/beam_load.c(150): Error loading module rez_escript:
  corrupt atom table


escript: exception error: undefined function rez_escript:main/1
  in function  escript:run/2 (escript.erl, line 904)
  in call from escript:start/1 (escript.erl, line 418)
  in call from init:start_it/1
  in call from init:start_em/1
  in call from init:do_boot/3

Going back to 1.19.3-otp27 with 27.3.4.6 and the escript binary works fine.

I couldn’t find anything much sensible via Google and errors in beam_load.c is a bit above my pay grade so I thought I would report it here.

Showing Posts 1 to 10

dimitarvp

dimitarvp

Never seen that, very interesting.

IMO you should make a small reproducible app and report this to the Erlang team on ErlangForums. They would be interested, I think.

jerdew

jerdew

Did you nuke deps too? Bc I’ve been switching between 1.18 and 1.19, I recently found a succinct way to delete it all from orbit: mix clean --deps

Edit: Right, _build contains the compiled deps, sorry. I got wires crossed because I had been using ‘mix clean’ and had run into issues with deps on the wrong Elixir version.

mattmower

mattmower OP

I’ve been nuking the _build folder.

fizfaz

fizfaz

searching for the error message I found this commit-message:

https://github.com/erlang/otp/commit/04b168dade6e798461893e32d8c59588a3e228fe

This commit changes the atom table in BEAM files to use a variable
length encoding for the length of each atom. For atoms up to 15 bytes,
the length is encoded in one byte. The header for the atom table is
also changed to indicate that new encoding of lengths are used.
Attempting to load a BEAM file compiled with Erlang/OTP 28 in
Erlang/OTP 27 or earlier will result in the following error message:

    1> l(t).
    =ERROR REPORT==== 8-Oct-2024::08:49:01.750424 ===
    beam/beam_load.c(150): Error loading module t:
      corrupt atom table

    {error,badfile}

so maybe an old runtime (27) is used for running the escript? :thinking:

jstimps

jstimps

Hi @mattmower, did you recompile the escript (mix escript.build)? This error seems like the kind of error that comes about when using BEAM code from a later OTP on an older OTP. I realize you’re going the other way, but still it makes me think this is a similar incompatibility. I’m not sure exactly how escript is expected to handle BEAM code versioning.

mattmower

mattmower OP

I have an install script that does the escript.build and moves the binary into the right place so I think so but of course I can’t be entirely certain that I didn’t good somehow.

jstimps

jstimps

Is it possible that wherever you’ve copied the escript to, at the time of execution the system is still finding the prev version OTP binaries on the PATH?

mattmower

mattmower OP

That I don’t believe is likely, because I was running & re-running as I was trying different versions of Elixir & OTP.

josevalim

josevalim

Creator of Elixir

This will happen if you compile a escript for Erlang/OTP 28 and then attempt to run it on Erlang/OTP 27 and earlier.

mattmower

mattmower OP

Ah, I think this reveals a misunderstanding that I have about escript.

When the docs said “This task guarantees the project and its dependencies are compiled and packages them inside an escript.” I mistakenly thought that included the OTP runtime.

So my problem is that I am compiling the escript against OTP28 but, when using the binary (outside the asdf folder where the binary is built) it’s finding the OTP27 runtime?

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews