Building my package works on my computer works on my computer but fails on GitLab - stumped by why OPAM is giving errors

See the build log: https://gitlab.com/emmeline/bexp/-/jobs/222647788

The error is:

[ERROR] /builds/emmeline/bexp/.opam exists, but does not appear to be a valid opam root. Please remove it and use `opam init', or specify a different `--root' argument

Reading the source code, it looks like this error occurs when .opam/config does not exist:

Indeed, when I rename .opam/config to something else on my own computer, I am able to cause the error message.

However, judging from the CI build output, .opam/config clearly exists. What gives?