softprops/action-gh-release "Validation Failed: already_exists"
GitHub rejects the release create call with 422 "already_exists" when a release for the same tag is already published. The action tries to create rather than reuse.
What this error means
A release step fails with "Validation Failed" and a field error "already_exists" on tag_name.
Error: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
##[error]Validation FailedCommon causes
Tag already has a release
A prior run or a manual release created the same tag, so creating again is a conflict.
Re-running a published tag
Re-running the job on an existing tag attempts to recreate the release instead of updating it.
How to fix it
Tie the release to a fresh tag, or allow updates
- Trigger the release on push of a new tag (on: push: tags) so each release maps to a unique tag.
- Or move/delete the stale tag and release before re-running.
- Re-run; the create call now succeeds.
on:
push:
tags: ['v*']
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}How to prevent it
- Drive releases from tag pushes so the tag is unique per release.
- Avoid re-running release jobs against an already-published tag.