Draft update fails with HTTP 500 duplicate tag (UQE_release_n) when escalating the tag, e.g. v0.0.9 -> v0.1.0 #47

Closed
opened 2026-10-02 17:21:24 +02:00 by robin.wieske · 0 comments
Owner

Summary

The action fails with an HTTP 500 (unique constraint violation on UQE_release_n) when it tries to update the existing draft release to a newly computed tag (v0.0.9 -> v0.1.0). No release or tag v0.1.0 is visible through the API, so the action cannot know why the name is taken, and every subsequent run fails the same way until someone intervenes by hand.

Error log

Draft release found: v0.0.9
An error occurred: Failed to create/update draft release v0.1.0 (status 500): {"message":"unique constraint violation: Error 1062 (23000): Duplicate entry '35-v0.1.0' for key 'UQE_release_n'","url":"https://forgejo.entwirr.me/api/swagger"}

Traceback (most recent call last):
  File "/release_drafter.py", line 534, in <module>
    manager.main()
    ~~~~~~~~~~~~^^
  File "/release_drafter.py", line 522, in main
    url = self.create_or_update_release(new_tag, release_notes, existing_draft)
  File "/release_drafter.py", line 476, in create_or_update_release
    raise ReleaseLookupError(
    ...<2 lines>...
    )
ReleaseLookupError: Failed to create/update draft release v0.1.0 (status 500): {"message":"unique constraint violation: Error 1062 (23000): Duplicate entry '35-v0.1.0' for key 'UQE_release_n'","url":"https://forgejo.entwirr.me/api/swagger"}

Context

  • Repo: Aevana/aevana (repo id 35), action pinned at 00c3d887380e93b451e27a08fa63c0d3f158b5f0 (v1), triggered by merged pull requests (Release Drafter workflow, pull_request: closed). The same failure shows on every merge to main.
  • State of the releases at the time of the failure (via the API):
    • exactly one draft: id 594, tag v0.0.9, target main
    • published releases v0.0.1 ... v0.0.8, tags v0.0.1 ... v0.0.8
    • GET /repos/Aevana/aevana/releases/tags/v0.1.0 returns 404, there is no v0.1.0 tag and no v0.1.0 release in the list
  • The newly computed tag is v0.1.0 (a feature PR merged since v0.0.8), so generate_next_tag() escalated from patch to minor. The draft was created as v0.0.9 earlier.

Since the fix for #44 (tag = new_tag), create_or_update_release() now sends a PATCH to the existing draft that changes tag_name (here v0.0.9 -> v0.1.0). Before that fix, the PATCH never changed tag_name, so this path was never exercised. Forgejo answers with a 500 from the database unique key (repo_id, lower_tag_name): either an invisible row with v0.1.0 already exists (for example a leftover from an earlier attempt or a half-applied update), or Forgejo's tag update for drafts conflicts with its own row. I could not tell which from the outside. Please treat this as a hypothesis.

Expected behaviour

  • A tag_name change on an existing draft should succeed, or fail with an error that tells the user what to do.
  • The action should not wedge permanently on a server-side 500.

Suggestions

  1. Before the PATCH, look up /releases/tags/<new_tag> and list all releases including drafts (?draft=true) to detect a conflicting row, and log what was found.
  2. If the PATCH with a changed tag_name returns 500/409/422, fall back to: create the new draft first (POST), then delete the old draft by id, and log the fallback. (Issue #44 discussed delete+create as a worse default, but as a fallback for this error it keeps the action working.)
  3. Include the request method, URL and a redacted request body in the error message so the failing call is reproducible without reading the action source.
  4. Consider retrying once for 5xx responses.

Workaround

Delete the existing draft release by hand in the Forgejo UI and re-run the workflow (workflow_dispatch) so the action takes the POST path.

## Summary The action fails with an HTTP 500 (unique constraint violation on `UQE_release_n`) when it tries to update the existing draft release to a newly computed tag (`v0.0.9` -> `v0.1.0`). No release or tag `v0.1.0` is visible through the API, so the action cannot know why the name is taken, and every subsequent run fails the same way until someone intervenes by hand. ## Error log ``` Draft release found: v0.0.9 An error occurred: Failed to create/update draft release v0.1.0 (status 500): {"message":"unique constraint violation: Error 1062 (23000): Duplicate entry '35-v0.1.0' for key 'UQE_release_n'","url":"https://forgejo.entwirr.me/api/swagger"} Traceback (most recent call last): File "/release_drafter.py", line 534, in <module> manager.main() ~~~~~~~~~~~~^^ File "/release_drafter.py", line 522, in main url = self.create_or_update_release(new_tag, release_notes, existing_draft) File "/release_drafter.py", line 476, in create_or_update_release raise ReleaseLookupError( ...<2 lines>... ) ReleaseLookupError: Failed to create/update draft release v0.1.0 (status 500): {"message":"unique constraint violation: Error 1062 (23000): Duplicate entry '35-v0.1.0' for key 'UQE_release_n'","url":"https://forgejo.entwirr.me/api/swagger"} ``` ## Context - Repo: `Aevana/aevana` (repo id 35), action pinned at `00c3d887380e93b451e27a08fa63c0d3f158b5f0` (`v1`), triggered by merged pull requests (`Release Drafter` workflow, `pull_request: closed`). The same failure shows on every merge to `main`. - State of the releases at the time of the failure (via the API): - exactly one draft: id 594, tag `v0.0.9`, target `main` - published releases `v0.0.1` ... `v0.0.8`, tags `v0.0.1` ... `v0.0.8` - `GET /repos/Aevana/aevana/releases/tags/v0.1.0` returns 404, there is no `v0.1.0` tag and no `v0.1.0` release in the list - The newly computed tag is `v0.1.0` (a `feature` PR merged since `v0.0.8`), so `generate_next_tag()` escalated from patch to minor. The draft was created as `v0.0.9` earlier. ## Why this is probably related to #44 Since the fix for #44 (`tag = new_tag`), `create_or_update_release()` now sends a `PATCH` to the existing draft that changes `tag_name` (here `v0.0.9` -> `v0.1.0`). Before that fix, the `PATCH` never changed `tag_name`, so this path was never exercised. Forgejo answers with a 500 from the database unique key `(repo_id, lower_tag_name)`: either an invisible row with `v0.1.0` already exists (for example a leftover from an earlier attempt or a half-applied update), or Forgejo's tag update for drafts conflicts with its own row. I could not tell which from the outside. Please treat this as a hypothesis. ## Expected behaviour - A `tag_name` change on an existing draft should succeed, or fail with an error that tells the user what to do. - The action should not wedge permanently on a server-side 500. ## Suggestions 1. Before the `PATCH`, look up `/releases/tags/<new_tag>` and list all releases including drafts (`?draft=true`) to detect a conflicting row, and log what was found. 2. If the `PATCH` with a changed `tag_name` returns 500/409/422, fall back to: create the new draft first (`POST`), then delete the old draft by id, and log the fallback. (Issue #44 discussed delete+create as a worse default, but as a fallback for this error it keeps the action working.) 3. Include the request method, URL and a redacted request body in the error message so the failing call is reproducible without reading the action source. 4. Consider retrying once for 5xx responses. ## Workaround Delete the existing draft release by hand in the Forgejo UI and re-run the workflow (`workflow_dispatch`) so the action takes the `POST` path.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Wi3eDigital/forgejo-release-drafter-action#47
No description provided.