Skip to content

Unable to remove team reviewer without specifying regular logins at the same time #12120

@alongosz

Description

@alongosz

Describe the bug

Seems it's not possible to remove a team reviewer by

gh pr edit --remove-reviewer "my-org/my-team"`

if the list to remove doesn't contain regular users' logins

meaning this:

gh pr edit --remove-reviewer "someone,my-org/my-team"

it works (removes both user and a team).

See the steps to reproduce for more details.

Affected version

gh version 2.83.0 (2025-11-04)
https://github.com/cli/cli/releases/tag/v2.83.0

Steps to reproduce the behavior

  1. Request a review from a team, let's call it acme/devs
  2. Try executing gh pr edit --remove-reviewer "acme/devs"
  3. See the following error:
HTTP 422: Invalid request. (https://api.github.com/repos/ibexa/rest/pulls/205/requested_reviewers)

"reviewers" wasn't supplied.

Expected vs actual behavior (and possible root cause)

Expected behavior is that I'm able to remove a team from review list. It was working not long ago, so I think something changed in GitHub REST API. Weirdly if I include a regular user in a list to remove, e.g.:

gh pr edit --remove-reviewer "alongosz,acme/devs"

both me and the team would be removed, no errors.

Following the REST API doc for removal of review requests, I can see that reviewers request body parameter is required, while team_reviewers is not.

That got me to debugging of gh pr edit behavior. Indeed it seems that the payload is missing required reviewers field (after all why would it, we specified team reviewers only)

{
  "team_reviewers": [
    "acme/devs"
  ]
}

When I tried the following raw API call:

gh api --method DELETE \ 
                -H "Accept: application/vnd.github+json" \
                -H "X-GitHub-Api-Version: 2022-11-28" /repos/acme/some-repo/pulls/1/requested_reviewers --input - <<< '{
                    "reviewers": [],
                    "team_reviewers": [
                        "acme/devs"
                    ]
            }'

it worked. Given that for gh pr edit --remove-reviewer there's one common list, not sure if I can get the same effect without using directly API.

The weird thing about it is that a few weeks ago it worked and seems like the latest GitHub REST API version is 2022-11-28.

Logs

Note: I've removed requests that seem to fetch metadata and replaced org,repo, and team names with fake data. Let me know if you need more of them actually.

$ gh pr edit --remove-reviewer "acme/devs"

(...)
* Request to https://api.github.com/repos/acme/some-repo/pulls/1/requested_reviewers
> DELETE /repos/acme/some-repo/pulls/1/requested_reviewers HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token <redacted>
> Content-Length: 31
> Content-Type: application/json; charset=utf-8
> Time-Zone: Europe/Warsaw
> User-Agent: GitHub CLI 2.83.0

> POST /graphql HTTP/1.1
> Host: api.github.com
{
  "team_reviewers": [
    "acme/devs"
  ]
}
(...)

* Request took 798.092985ms
HTTP 422: Invalid request. (https://api.github.com/repos/ibexa/rest/pulls/205/requested_reviewers)

"reviewers" wasn't supplied.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggh-prrelating to the gh pr commandp2Affects more than a few users but doesn't prevent core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions