Build fails after running dune subst

I have a project I created using spin, which uses esy which uses dune under the hood.
Everything works fantastically, tests passes and even the CI is always on green.
However, when it is time to release I get build errors, which it doesn’t always happen.

The steps that are executed on ci release are:

  1. esy install
  2. esy build --release
  3. esy dune subst
  4. esy dune buil

The problem is after the esy dune subst step. The next build succeeds, but any step after that, fails. Here is an example of it building without problem:

That was the only time where it built both for ubuntu and mac. After that, it only succeeds on ubuntu and on my local.

The latest release just passed after restarting it 2 or 3 times, so there is obviously some race condition that I’m unable to figure.

The project is here if you want to take a look: