I run into the same issue as
SLURM “srun module load” command exits with error
The answer explains that the simple solution is to run module load outside srun.
However, that is not always so simple if you have a complex cluster management tool that doesn’t work that way. Is there a workaround to make module work in srun? (Can I source some file explicitly to make module available?)