Uploading build.env fails

I’m using a Windows powershell runner (on a self-hosted gitlab 13.2.6-ee), and I have a script step in a stage that writes to ‘build.env’. I then try to upload that as an artifact report:

artifacts:
reports:
dotenv: build.env

But the build keeps failing:

Uploading artifacts…

44Runtime platform arch=amd64 os=windows pid=7864 revision=738bbe5a version=13.3.1

45build.env: found 1 matching files and directories

46WARNING: Failed to load system CertPool: crypto/x509: system root pool is not available on Windows

47WARNING: Uploading artifacts as “dotenv” to coordinator… failed id=19556 responseStatus=500 Internal Server Error status=500 token=8TuGoYfQ

48WARNING: Retrying… context=artifacts-uploader error=invalid argument

49WARNING: Uploading artifacts as “dotenv” to coordinator… failed id=19556 responseStatus=500 Internal Server Error status=500 token=8TuGoYfQ

50WARNING: Retrying… context=artifacts-uploader error=invalid argument

51WARNING: Uploading artifacts as “dotenv” to coordinator… failed id=19556 responseStatus=500 Internal Server Error status=500 token=8TuGoYfQ

52FATAL: invalid argument

54ERROR: Job failed: exit status 1