Error: Error 422: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
jlarmstrongiv opened this issue · comments
Describe the bug
Error: Error 422: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
To Reproduce
It is not a consistent error, but occurs a few times a week. The gist of it is that I have multiple jobs publishing a single release. I also have allowUpdates: true
and replacesArtifacts: true
.
The tag tag: ${{ needs.setup.outputs.tag }}
is the same for all jobs.
The code is available https://github.com/jlarmstrongiv/prebuilds/actions
Expected behavior
Releases as expected.
Desktop (please complete the following information):
- OS: Ubuntu
- Browser N/A
- Version 20.04.5 LTS
Additional context
The difficult part in debugging this error is the inconsistencies. If there’s any other debugging I can do, please let me know.
This action is not atomic - that is to say, it works by making potentially multiple calls to the github API. If you have multiple jobs all trying to interact with the same release, it is definitely possible you can run into unexpected errors. For example, if you have two concurrent jobs interacting with a release, it's possible for both jobs to think there is no release and try to create it, rather than one creating it and the other updating it.
You should try and setup your CI so you can ensure that you only have a single job trying to create / update the release at once.
I had the problem when created a Release manually in GitHub UI and created a new tag.
This is the only way to create a tag in UI so I just used the Release.
And the action was confused because the release already exists.
I also tried replaceArtifacts option but it didn't helped. So I had to use a git command line to create and push a tag.
Maybe the error message can be made more clear to users.