electron-builder: Unable to publish assets to Github (ReleaseAsset asset_already_exists)

  • Version: 20.38.4
  • Target: mac/windows/linux

Since updating from 20.38.2 -> 20.38.4 electron-build has been unable to publish assets to a github release page. Downgrading to 20.38.2 resolves the issue.

It fails on publishing every asset from every os.

Here is an example: https://travis-ci.org/LN-Zap/zap-desktop/jobs/469993385#L2805

2018-12-19T13:21:03.988Z electron-builder Response: 422 Unprocessable Entity, request options: {
  "hostname": "uploads.github.com",
  "path": "/repos/LN-Zap/zap-desktop/releases/13734557/assets?name=ZapDesktop-linux-i386-v0.3.0-beta.deb",
  "method": "POST",
  "headers": {
    "accept": "application/vnd.github.v3+json",
    "Content-Type": "application/octet-stream",
    "Content-Length": 52382742,
    "authorization": "<stripped sensitive data>",
    "User-Agent": "electron-builder",
    "Cache-Control": "no-cache"
  }
}
  • async task error error=
                       422 Unprocessable Entity
                       {
                         "message": "Validation Failed",
                         "request_id": "E166:5EBB:2E3AE0:33E8F0:5C1A45BF",
                         "documentation_url": "https://developer.github.com/v3",
                         "errors": [
                           {
                             "resource": "ReleaseAsset",
                             "code": "already_exists",
                             "field": "name"
                           }
                         ]
                       }
                       Headers: {
                         "cache-control": "no-cache",
                         "content-length": "211",
                         "content-security-policy": "default-src 'none'",
                         "content-type": "application/json; charset=utf-8",
                         "strict-transport-security": "max-age=31557600",
                         "x-accepted-oauth-scopes": "repo",
                         "x-content-type-options": "nosniff",
                         "x-frame-options": "deny",
                         "x-github-media-type": "github.v3; format=json",
                         "x-oauth-scopes": "public_repo",
                         "x-xss-protection": "1; mode=block",
                         "date": "Wed, 19 Dec 2018 13:21:04 GMT",
                         "connection": "close",
                         "x-github-request-id": "E166:5EBB:2E3AE0:33E8F0:5C1A45BF"
                       }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zap-desktop@0.3.0-beta package: `npm run build && npm run fetch-lnd && build "--publish" "onTagOrDraft" "--linux"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zap-desktop@0.3.0-beta package script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2018-12-19T13_21_04_026Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Script failed with status 1
failed to deploy

If I delete the existing assets from the draft github release and try again then it works, but only the first time. Every subsequent attempt fails with the same error ^.

Here are some other similar issues where this was reported in the past:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 26

Commits related to this issue

Most upvoted comments

I’m having this exact issue in v23.3.3. (Replaced some sensitive data with ******)

• uploading       file=******.exe.blockmap provider=github
• uploading       file=******.exe provider=github
• overwrite published file  file=******.exe.blockmap reason=already exists on GitHub
HttpError: 422 Unprocessable Entity
"method: POST url: https://uploads.github.com/repos/******/******/releases/7[66]
(https://github.com/******/******/runs/8258036281?check_suite_focus=true#step:7:67)30150/assets?name=******.exe\n\n          
Data:\n          {\"message\":\"Validation Failed\",\"request_id\":\"0400:1175:8C5CF:B4ED6:631A5022\",\"documentation_url\":\"[https://docs.github.com/rest\](https://docs.github.com/rest/)",\"errors\":
[{\"resource\":\"ReleaseAsset\",\"code\":\"already_exists\",\"field\":\"name\"}]}\n          "

@SupremeTechnopriest in my case, the release only existed as a draft release. In the past this has always worked and I thought this was the standard process.

  1. Create a draft release
  2. Every build will upload new assets to the draft release, replacing those of prior builds
  3. Publish the draft when you are ready to release.

Has this changed?

Same problem in v22.13.1 Last work version: 22.11.7

same issue came up upgrading from 22.11.7 to 22.13.1

I guess something did change because you can’t have the draft release created beforehand now. Electron builder creates it for you.

On Wed, Jan 30, 2019, 10:06 AM Henrique Dias <notifications@github.com wrote:

@SupremeTechnopriest https://github.com/SupremeTechnopriest in my case, the release only existed as a draft release. In the past this has always worked and I thought this was the standard process.

  1. Create a draft release
  2. Every build will upload new assets to the draft release, replacing those of prior builds
  3. Publish the draft when you are ready to release.

Has this changed?

That’s what we were expecting. But since we upgraded to the latest release, it broke. Any updates on this @pgebheim https://github.com/pgebheim?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/electron-userland/electron-builder/issues/3559#issuecomment-459047385, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKCXtodUb9I3L9XSTW-zP4vQOkiHeEcks5vId8pgaJpZM4ZaPe0 .

@mrfelton @TrevorSayre This isn’t a bug. The release you are trying to push already exists on github. You either have to bump your package.json version or delete the old release from github to overwrite the version.