Skip to content

fix(github_org): handle 422 in a nicer way#288

Open
nobe4 wants to merge 1 commit into
mainfrom
422
Open

fix(github_org): handle 422 in a nicer way#288
nobe4 wants to merge 1 commit into
mainfrom
422

Conversation

@nobe4

@nobe4 nobe4 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

It's not possible to get from the API which user blocked you. This is great to prevent spam and abuses. It however makes it difficult to also detect early when an invite to an org is going to fail.

At scale, this might mean that users see many invitation at once and decide to just block the user instead of refusing the invitations. In which case entitlements doesn't handle the resulting 422 and fails with

'Octokit::Response::RaiseError#on_complete': PUT https://api.github.com/teams/<id>/memberships/<handle>: 422 - Validation Failed (Octokit::UnprocessableEntity)

This change hopes to ease this pain by warning but not failing on such cases. It would then be up to the owner of the orgs to verify which invitations went through.

It's not possible to get from the API which user blocked you. This is
great to prevent spam and abuses. It however makes it difficult to also
detect early when an invite to an org is going to fail.

At scale, this might mean that users see many invitation at once and
decide to just block the user instead of refusing the invitations. In
which case entitlements doesn't handle the resulting 422 and fails with

```
'Octokit::Response::RaiseError#on_complete': PUT https://api.github.com/teams/<id>/memberships/<handle>: 422 - Validation Failed (Octokit::UnprocessableEntity)
```

This change hopes to ease this pain by warning but not failing on such
cases. It would then be up to the owner of the orgs to verify which
invitations went through.

@trespilhas trespilhas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants