goreleaser: [Bug]: error uploading artifacts to github releases

What happened?

Artifacts sometimes fail to upload, due to github API failures.

This is similar to the issue reported in #2506. AFAICT, it’s an issue on github’s end. Here’s a larger log of output from my build running in a github action:


• uploading to release      file=dist/checksums.txt name=checksums.txt
• failed to upload artifact, will retry artifact=checksums.txt error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=checksums.txt: 502 Error uploading to https://objects-origin.githubusercontent.com/github-production-release-asset-2e65be: 500 [] try=1
• uploading to release      file=dist/checksums.txt name=checksums.txt
• failed to upload artifact, will retry artifact=checksums.txt error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=checksums.txt: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=2

• uploading to release      file=dist/traefik-kop_0.8.1_Linux_arm64.tar.gz name=traefik-kop_0.8.1_Linux_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_arm64.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_arm64.tar.gz: 502 Error uploading to https://objects-origin.githubusercontent.com/github-production-release-asset-2e65be: 500 [] try=1
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_arm64.tar.gz name=traefik-kop_0.8.1_Linux_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_arm64.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_arm64.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=2

• uploading to release      file=dist/traefik-kop_0.8.1_Linux_x86_64.tar.gz name=traefik-kop_0.8.1_Linux_x86_64.tar.gz

• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv6.tar.gz name=traefik-kop_0.8.1_Linux_armv6.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv6.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv6.tar.gz: 502 Error uploading to https://objects-origin.githubusercontent.com/github-production-release-asset-2e65be: 500 [] try=1
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv6.tar.gz name=traefik-kop_0.8.1_Linux_armv6.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv6.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv6.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 11; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=2
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv6.tar.gz name=traefik-kop_0.8.1_Linux_armv6.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv6.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv6.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 13; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=3
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv6.tar.gz name=traefik-kop_0.8.1_Linux_armv6.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv6.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv6.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=4

• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_arm64.tar.gz name=traefik-kop_0.8.1_Darwin_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_arm64.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_arm64.tar.gz: 502 Error uploading to https://objects-origin.githubusercontent.com/github-production-release-asset-2e65be: 500 [] try=1
• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_arm64.tar.gz name=traefik-kop_0.8.1_Darwin_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_arm64.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_arm64.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 25; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=2
• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_arm64.tar.gz name=traefik-kop_0.8.1_Darwin_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_arm64.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_arm64.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 29; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=3
• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_arm64.tar.gz name=traefik-kop_0.8.1_Darwin_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_arm64.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_arm64.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 33; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=4
• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_arm64.tar.gz name=traefik-kop_0.8.1_Darwin_arm64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_arm64.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_arm64.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=5

• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv7.tar.gz name=traefik-kop_0.8.1_Linux_armv7.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv7.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv7.tar.gz: 502 Error uploading to https://objects-origin.githubusercontent.com/github-production-release-asset-2e65be: 500 [] try=1
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv7.tar.gz name=traefik-kop_0.8.1_Linux_armv7.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv7.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv7.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 23; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=2
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv7.tar.gz name=traefik-kop_0.8.1_Linux_armv7.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv7.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv7.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 27; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=3
• uploading to release      file=dist/traefik-kop_0.8.1_Linux_armv7.tar.gz name=traefik-kop_0.8.1_Linux_armv7.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Linux_armv7.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Linux_armv7.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=4

• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_x86_64.tar.gz name=traefik-kop_0.8.1_Darwin_x86_64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_x86_64.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_x86_64.tar.gz: 502 Error uploading to https://objects-origin.githubusercontent.com/github-production-release-asset-2e65be: 500 [] try=1
• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_x86_64.tar.gz name=traefik-kop_0.8.1_Darwin_x86_64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_x86_64.tar.gz error=Post "https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_x86_64.tar.gz": http2: Transport: cannot retry err [stream error: stream ID 39; REFUSED_STREAM; received from peer] after Request.Body was written; define Request.GetBody to avoid this error try=2
• uploading to release      file=dist/traefik-kop_0.8.1_Darwin_x86_64.tar.gz name=traefik-kop_0.8.1_Darwin_x86_64.tar.gz
• failed to upload artifact, will retry artifact=traefik-kop_0.8.1_Darwin_x86_64.tar.gz error=POST https://uploads.github.com/repos/jittering/traefik-kop/releases/54810593/assets?name=traefik-kop_0.8.1_Darwin_x86_64.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] try=3

I cleaned up and sorted the output so its easier to read. It seems that in each case, a 5xx error is followed by 422 on each successive retry. In this scenario, it might be necessary to check the list of release assets and/or delete it before retrying.

In my case, it took my several rebuilds (5 tries) with manually deleting the release in between until I was able to get a clean build where every artifact uploaded properly.

How can we reproduce this?

Seems to be a github issue, not sure there will be an easy way to reproduce

goreleaser version

goreleaser version 1.1.0
commit: af4a8642bddb171914ee932bfb5768f102c3516f

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 21 (17 by maintainers)

Most upvoted comments

But from what I hear there’s no workaround in goreleaser, right?

correct - see https://github.com/goreleaser/goreleaser/issues/2746#issuecomment-1009079939

ok, will close this then

thanks all!

No reply, I had no more problem (after I reported, ANY more releases were generated using goreleaser)

@caarlos0 if we put a parameter to force (aka --force) the replacement of the file?

I don’t like the idea…

  • if its a flag, it would require the user to either change their CI config and retag (which is not good) or run from their machines instead of CI (also not that good)
  • if its a config, to be safe, they would have to always have that set there… which would still lead to retag if its not there beforehand, or to accidental destruction actions if it is always there…

to me it seems the right thing is to fix this on go-github

[{Resource:ReleaseAsset Field:name Code:already_exists Message:}]

when this happens, it usually means that goreleaser ran multiple times against the same tag, as the files are already there…

we should probably drop the retries in this case though