releaser-tools icon indicating copy to clipboard operation
releaser-tools copied to clipboard

GitHubError: Validation Failed (422)

Open picosam opened this issue 6 years ago • 12 comments

Hello, I'm getting the following error when running conventional-github-releaser -p angular

GitHubError: Validation Failed (422)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] github-release: `conventional-github-releaser -p angular`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] github-release 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!     /Users/Sammy/.npm/_logs/2017-11-20T16_07_15_550Z-debug.log

Here's the log file in question:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.7.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'github-release' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pregithub-release', 'github-release', 'postgithub-release' ]
5 info lifecycle [email protected]~pregithub-release: [email protected]
6 info lifecycle [email protected]~github-release: [email protected]
7 verbose lifecycle [email protected]~github-release: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~github-release: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Sammy/Projects/angular-project-starter/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle [email protected]~github-release: CWD: /Users/Sammy/Projects/angular-project-starter
10 silly lifecycle [email protected]~github-release: Args: [ '-c', 'conventional-github-releaser -p angular' ]
11 silly lifecycle [email protected]~github-release: Returned: code: 1  signal: null
12 info lifecycle [email protected]~github-release: Failed to exec github-release script
13 verbose stack Error: [email protected] github-release: `conventional-github-releaser -p angular`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/Sammy/Projects/angular-project-starter
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node/8.7.0/bin/node" "/usr/local/bin/npm" "run" "github-release"
18 verbose node v8.7.0
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] github-release: `conventional-github-releaser -p angular`
22 error Exit status 1
23 error Failed at the [email protected] github-release script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

picosam avatar Nov 20 '17 16:11 picosam

By the way, when I run echo $CONVENTIONAL_GITHUB_RELEASER_TOKEN from my command line I get my GitHub token correctly!

picosam avatar Nov 21 '17 16:11 picosam

@picosam can you please provide us a set of steps to reproduce the error? (Some way for us to set up a similar project and environment)

hutson avatar Jan 24 '18 03:01 hutson

I'm getting this as well. Installed this locally rather than globally. Ran the command as follows:

names have been changed to protect the innocent

CONVENTIONAL_GITHUB_RELEASER_TOKEN=<valid access token> CONVENTIONAL_GITHUB_URL=https://<base URL for GHE>/api/v3/ ./node_modules/.bin/conventional-github-releaser -p angular -r 0

iamnewton avatar Jun 14 '18 02:06 iamnewton

Experiencing the same issue. the token is set, checked with echo $CONVENTIONAL_GITHUB_RELEASER_TOKEN

phun-ky avatar Jul 31 '18 10:07 phun-ky

same here, token provided by -t flag

CanRau avatar Sep 29 '18 09:09 CanRau

any updates?

dortzur avatar Dec 17 '18 11:12 dortzur

I believe this happens when you already have a release available for that semver version. Updating the semver version in package.json worked for me.

dortzur avatar Dec 17 '18 11:12 dortzur

I think @dortzur is correct, but GitHub errors have, in my experience, been cryptic.

We have a debug option now - https://github.com/conventional-changelog/releaser-tools/tree/master/packages/conventional-github-releaser#debugging

@picosam @iamnewton @CanRau can one of y'all please provide us the results of the debug output? (With any sensitive URL information removed)

hutson avatar Dec 20 '18 02:12 hutson

I tried to regenerate all realeases on this repo: https://github.com/MTES-MCT/camino-flux/releases and I have the same error

the debug info:

± |master → origin ✓| → DEBUG=conventional-github-releaser conventional-github-releaser -p angular -r 0
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n\n', draft: false, name: 'v0.7.3', prerelease: false, tag_name: 'v0.7.3', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +0ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n\n', draft: false, name: 'v0.7.1', prerelease: false, tag_name: 'v0.7.1', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +17ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n### Features\n\n* **api:** ajoute le champs entreprise.etablissements dans le schema graphQL ([d861028](https://github.com/MTES-MCT/camino-ui/commit/d861028))\n\n\n\n', draft: false, name: 'v0.7.0', prerelease: false, tag_name: 'v0.7.0', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +35ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n\n', draft: false, name: 'v0.6.2', prerelease: false, tag_name: 'v0.6.2', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +7ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n### Bug Fixes\n\n* **api:** corrige la structure de la requête GraphQl ([55f2d04](https://github.com/MTES-MCT/camino-ui/commit/55f2d04))\n\n\n\n', draft: false, name: 'v0.6.1', prerelease: false, tag_name: 'v0.6.1', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +16ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n### Features\n\n* supprime le https ([81ee360](https://github.com/MTES-MCT/camino-ui/commit/81ee360))\n\n\n### Reverts\n\n* **https:** remet le hhtps ([b442167](https://github.com/MTES-MCT/camino-ui/commit/b442167))\n\n\n\n', draft: false, name: 'v0.6.0', prerelease: false, tag_name: 'v0.6.0', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +33ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n### Bug Fixes\n\n* typo ([b7eb11b](https://github.com/MTES-MCT/camino-ui/commit/b7eb11b))\n\n\n### Features\n\n* **docker:** ne force pas la redirection vers https ([b7ca060](https://github.com/MTES-MCT/camino-ui/commit/b7ca060))\n* **readme:** ajoute les coordonnées du support technique ([1026506](https://github.com/MTES-MCT/camino-ui/commit/1026506))\n\n\n\n', draft: false, name: 'v0.5.0', prerelease: false, tag_name: 'v0.5.0', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +16ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n### Features\n\n* supprime la liste des flux du readme ([972262e](https://github.com/MTES-MCT/camino-ui/commit/972262e))\n\n\n\n', draft: false, name: 'v0.4.0', prerelease: false, tag_name: 'v0.4.0', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +28ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: '\n\n### Features\n\n* ajoute le contenu du fichier readme.txt ([94844ef](https://github.com/MTES-MCT/camino-ui/commit/94844ef))\n\n\n\n', draft: false, name: 'v0.3.0', prerelease: false, tag_name: 'v0.3.0', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +13ms
  conventional-github-releaser posting { endpoint: 'https://api.github.com/', body: { body: "\n\n### Bug Fixes\n\n* ajoute geometry dans la requête ([3107991](https://github.com/MTES-MCT/camino-ui/commit/3107991))\n* ajoute le dossier public dans git ([6bac399](https://github.com/MTES-MCT/camino-ui/commit/6bac399))\n* change le nom des fichiers exportés ([a80d391](https://github.com/MTES-MCT/camino-ui/commit/a80d391))\n* config docker du serveur de test ([563512b](https://github.com/MTES-MCT/camino-ui/commit/563512b))\n* corrige la structure des coordonnées ([0b823fe](https://github.com/MTES-MCT/camino-ui/commit/0b823fe))\n* décommente les flux des titres dont le statut est échu ([ff6fbe6](https://github.com/MTES-MCT/camino-ui/commit/ff6fbe6))\n* déploiement ([9f7555e](https://github.com/MTES-MCT/camino-ui/commit/9f7555e))\n* déploiement ([2dc106f](https://github.com/MTES-MCT/camino-ui/commit/2dc106f))\n* déploiement ([dda6385](https://github.com/MTES-MCT/camino-ui/commit/dda6385))\n* déploiement ([63ce5e5](https://github.com/MTES-MCT/camino-ui/commit/63ce5e5))\n* déploiement ([fc6ddc1](https://github.com/MTES-MCT/camino-ui/commit/fc6ddc1))\n* geometry ([bf68cf1](https://github.com/MTES-MCT/camino-ui/commit/bf68cf1))\n* insère le tableau dans une propriété FeatureCollection ([c2687c8](https://github.com/MTES-MCT/camino-ui/commit/c2687c8))\n* mise à jour de l'API ([943711d](https://github.com/MTES-MCT/camino-ui/commit/943711d))\n* requête graphql ([c88a2f1](https://github.com/MTES-MCT/camino-ui/commit/c88a2f1))\n* structure du geojson ([0b5d25d](https://github.com/MTES-MCT/camino-ui/commit/0b5d25d))\n\n\n### Features\n\n* affiche les phases ([662b8ea](https://github.com/MTES-MCT/camino-ui/commit/662b8ea))\n* ajout de la surface et du volume ([72e7c7f](https://github.com/MTES-MCT/camino-ui/commit/72e7c7f))\n* ajout des couleurs ([cad1cb8](https://github.com/MTES-MCT/camino-ui/commit/cad1cb8))\n* calcul des dates de début, fin et demande ([387ba5f](https://github.com/MTES-MCT/camino-ui/commit/387ba5f))\n* connection à la nouvelle API ([5bac415](https://github.com/MTES-MCT/camino-ui/commit/5bac415))\n* crée les flux à partir d'un fichier externe ([e3294d2](https://github.com/MTES-MCT/camino-ui/commit/e3294d2))\n* déploiement sur ovh ([8e7e824](https://github.com/MTES-MCT/camino-ui/commit/8e7e824))\n* déploiement sur ovh ([1d9a0d9](https://github.com/MTES-MCT/camino-ui/commit/1d9a0d9))\n* génère des propriétés de geojson à plat (clé, valeur) ([8c139a9](https://github.com/MTES-MCT/camino-ui/commit/8c139a9))\n* génère les fichiers geojson ([2e8e574](https://github.com/MTES-MCT/camino-ui/commit/2e8e574))\n* liste les nouveaux flux ([dea3447](https://github.com/MTES-MCT/camino-ui/commit/dea3447))\n* mise à jour de l'api ([303979d](https://github.com/MTES-MCT/camino-ui/commit/303979d))\n* mise à jour de l'API (arguments au pluriel) ([ad7d8e9](https://github.com/MTES-MCT/camino-ui/commit/ad7d8e9))\n* n'affiche pas les titres échus ([29585de](https://github.com/MTES-MCT/camino-ui/commit/29585de))\n\n\n\n", draft: false, name: 'v0.2.0', prerelease: false, tag_name: 'v0.2.0', target_commitish: undefined } } to the following URL - repos/MTES-MCT/camino-ui/releases +73ms
GitHubError: Validation Failed (422)

francoisromain avatar Mar 18 '19 23:03 francoisromain

it works for me now. I am not sure about what solved the problem, but two things chnaged:

  • standard-version was updated from v 5.0.2 to 6.0.1
  • I fixed the url of the repo in package.json which was pointing to a wrong place

francoisromain avatar May 08 '19 13:05 francoisromain

This is happening mainly if you try to create a release that already exists:

curl -X POST https://api.github.com/repos/kikobeats/automate-release/releases -H "Authorization: token GH_TOKEN" \
    -d '{ "tag_name": "v2.0.8", "generate_release_notes: true }'
{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "Release",
      "code": "already_exists",
      "field": "tag_name"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-release"
}

In that case, the library could fall back into update the release. There is an endpoint for doing that: https://docs.github.com/en/rest/reference/repos#update-a-release

Kikobeats avatar Oct 13 '21 21:10 Kikobeats

Hello, I'm getting the following error when running conventional-github-releaser -p angular

GitHubError: Validation Failed (422)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] github-release: `conventional-github-releaser -p angular`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] github-release 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!     /Users/Sammy/.npm/_logs/2017-11-20T16_07_15_550Z-debug.log

Here's the log file in question:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.7.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'github-release' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pregithub-release', 'github-release', 'postgithub-release' ]
5 info lifecycle [email protected]~pregithub-release: [email protected]
6 info lifecycle [email protected]~github-release: [email protected]
7 verbose lifecycle [email protected]~github-release: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~github-release: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Sammy/Projects/angular-project-starter/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle [email protected]~github-release: CWD: /Users/Sammy/Projects/angular-project-starter
10 silly lifecycle [email protected]~github-release: Args: [ '-c', 'conventional-github-releaser -p angular' ]
11 silly lifecycle [email protected]~github-release: Returned: code: 1  signal: null
12 info lifecycle [email protected]~github-release: Failed to exec github-release script
13 verbose stack Error: [email protected] github-release: `conventional-github-releaser -p angular`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/Sammy/Projects/angular-project-starter
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node/8.7.0/bin/node" "/usr/local/bin/npm" "run" "github-release"
18 verbose node v8.7.0
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] github-release: `conventional-github-releaser -p angular`
22 error Exit status 1
23 error Failed at the [email protected] github-release script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Suggestion

In my particular case, I experienced this problem because when executing the command conventional-github-releaser -p angular -r 0, no message appeared providing information on whether the release was completed successfully or not. Due to this, I re-executed the command and an error appeared.

It would be great if the developers added feedback on the operations. It would be very helpful. 🫶

Solution

The error "GitHubError: Validation Failed (422)" occurs when the release version already exists on GitHub or when the repository URL is invalid in the package.json.

To solve this error, you can try the following:

  1. Verify that the release version does not exist on GitHub.
  2. Verify that the repository URL is valid in the package.json .
  3. Create a new token and select the public_repo scope (or repo to access private repositories). Run the following command to set the token as an environment variable: export CONVENTIONAL_GITHUB_RELEASER_TOKEN=<MY_TOKEN>
  4. Run the command conventional-github-releaser -p angular -r 0

By following these steps, you should resolve your problem. I hope this helps.

thebug404 avatar Apr 13 '23 17:04 thebug404