Sitelet https://github.com/github/github-mcp-server/issues/3756
Skip to content

create_pull_request / update_pull_request return an error after the PR was created or edited (reviewer step fails) #3756

Open

Description

@rafe-walker

Describe the bug

Both tools do several REST and GraphQL calls in sequence. If the reviewer request fails after the main call has succeeded, the tool returns isError with only the reviewer error:

  • create_pull_request: the PR has been created, but the error text has no PR number or URL. A caller that retries gets A pull request already exists for OWNER:head, and still has no number.
  • update_pull_request: the title (and any other edited fields) has already been applied, but the result is an error, so a caller will assume nothing changed.

Conditions (tested): the reviewer request fails with GitHub 422 when the reviewer is the PR author ("Review cannot be requested from pull request author.") or is not a collaborator ("Reviews may only be requested from collaborators…"). A login that doesn't exist does not fail: GitHub accepts the request, the tool reports success, and the PR ends up with no requested reviewer.

Code (main 99d6d65, unchanged since v2.1.0): pkg/github/pullrequests.go:855 (PullRequests.Create), then :874-899 (RequestReviewers; on failure it returns NewGitHubAPIErrorResponse(ctx, "failed to request reviewers", …) (:882; the status variant at :899 is only reached for a non-2xx response without a Go error) and drops pr). For updates: :1090 (PullRequests.Edit), :1109-1173 (draft-state GraphQL mutation), then :1176-1209 (error return at :1190) (RequestReviewers, same error path). By code reading, the draft mutation step can partially apply the same way. Not tested.

Related: #3424 (open; clients cannot tell 'refused' from 'may have happened' for write errors).

Affected version

v2.1.0 (image sha256:f6056fc1…0f8a, commit 4bcdcdf) and main nightly (image sha256:48bc16d0…338f, revision 99d6d65).

Steps to reproduce the behavior

(123 stands for the issue/PR number.)

  1. Call it with the authenticated user (the PR author) as reviewer:
    {"name":"create_pull_request","arguments":{"owner":"OWNER","repo":"REPO","title":"t","head":"feature","base":"scratch-base","body":"b","reviewers":["<authenticated user's login>"]}}
    Result: isError with failed to request reviewers: Review cannot be requested from pull request author.. GET /pulls?head=OWNER:feature shows the PR open.
  2. Repeat the same call. Result: failed to create pull request: Validation Failed … A pull request already exists for OWNER:feature.
  3. Step 1 with "reviewers":["octocat"] (not a collaborator) behaves the same way.
  4. Step 1 with "reviewers":["no-such-user-zz9"] returns success {"id":"…","url":".../pull/N"}, and requested_reviewers is empty.
  5. Call:
    {"name":"update_pull_request","arguments":{"owner":"OWNER","repo":"REPO","pullNumber":123,"title":"changed","reviewers":["<author login>"]}}
    Result: isError (failed to request reviewers: …), but GET /pulls/N shows title: "changed". A non-collaborator reviewer behaves the same.

Expected vs actual behavior

Expected: when the PR was created or edited, the result says so and includes the number and URL, with the reviewer failure reported as a warning or partial failure ("PR N created; requesting reviewers failed: …").

Actual: a bare error, which reads as if nothing happened. On create, the PR number is lost, and a retry can't recover it.

Suggested fix: after a successful create or edit, don't return early on reviewer or draft errors. Return the normal result with the PR number and URL, plus a message listing which follow-up steps failed. Optionally, validate reviewers (author or collaborator) before creating.

Logs

create_pull_request reviewers=[author]       -> ISERROR failed to request reviewers: Review cannot be requested from pull request author.   (PR created)
  retry                                      -> ISERROR failed to create pull request: Validation Failed / PullRequest (custom): A pull request already exists for OWNER:feature.
create_pull_request reviewers=[octocat]      -> ISERROR failed to request reviewers: Reviews may only be requested from collaborators. …   (PR created)
create_pull_request reviewers=[no-such-user] -> OK {"id":"…","url":"…/pull/N"}; requested_reviewers []
update_pull_request title+reviewers=[author] -> ISERROR failed to request reviewers: …; title after = "changed"

Same results on v2.1.0 and main.

Found during an independent audit of v2.1.0 on a throwaway org and private test repo. Prepared with AI assistance (Claude Code); reproduced by two independent test runs before filing.

Activity

  1. rafe-walker commented on Nov 12, 2026

    @rafe-walker
    Author

    I read #3784 against the steps above. This is from reading the change, not a test run.

    • Steps 1 and 3 (author or non-collaborator as reviewer on create_pull_request): the error now reads pull request #N was created (<url>), but failed to request reviewers: …. A caller gets the number back and doesn't need to retry into "A pull request already exists".
    • Step 5 (update_pull_request with a title change and a failing reviewer): the error now starts pull request #N was updated, but …. The same prefix applies when the draft-state mutation or the final read fails after an earlier step succeeded.
    • The result stays isError rather than becoming success with a warning. The PR explains why (existing callers that check isError behave the same). Either works for the problem reported here, since the text now says what was applied.
    • Step 4 (a login that doesn't exist is accepted by GitHub and silently dropped) is unchanged. Catching it would need a check before the request, and that can be separate.
    • Copilot's remaining point is that a client-acquisition failure after an earlier step still returns a bare error. It's small, but it would make the "was updated" wording consistent.

    Happy to re-run the original reproduction once a maintainer is happy with the approach.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions