GitHub: why the pull request was not created
A pull request is created with POST /repos/OWNER/REPO/pulls: title, head (the branch with your changes; from a fork in the same network, USER:BRANCH), base (an existing branch of this repository), and if you like body, draft and maintainer_can_modify. GitHub's documentation names the statuses: 201 when it is created, 403, and 422 when the request fails validation or the endpoint has been spammed. It does not list the 422 messages; the ones below are quoted from public reports, with GitHub's documented rules behind them (checked October 25, 2026).
HTTP/1.1 422 Unprocessable Entity
{"message": "Validation Failed", "errors": [{"resource": "PullRequest", "code": "custom", "message": "No commits between main and my-branch"}], "documentation_url": "https://docs.github.com/rest/pulls/pulls#create-a-pull-request", "status": "422"}
422: what GitHub says, and why
A pull request already exists for OWNER:BRANCH.(codecustom): an open pull request from this head branch is already there.No commits between BASE and HEAD(codecustom): the head branch has no commit that the base branch does not have. The new commits are not pushed yet, the branch was already merged, orheadandbasename the wrong branches.{"resource":"PullRequest","field":"head","code":"invalid"}: GitHub does not findhead: the branch is not on GitHub yet, its name is spelled differently, or it is in a fork and was sent withoutUSER:. GitHub's documentation says that a pull request between two repositories owned by the same organization also needshead_repo.{"resource":"PullRequest","field":"base","code":"invalid"}:baseis not a branch of this repository. GitHub's documentation says it should be an existing branch of the repository, and that a pull request cannot ask to merge into a branch of another repository.Draft pull requests are not supported in this repository.: GitHub's documentation says drafts are available in public repositories with GitHub Free, GitHub Free for organizations, GitHub Pro and legacy per-repository plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. A draft in a private repository on GitHub Free or GitHub Pro is refused.
403, 404
- 403
GitHub Actions is not permitted to create or approve pull requests.: the token is a workflow'sGITHUB_TOKEN, and the repository does not allow Actions to create and approve pull requests (see why GitHub refused the review, where the same setting refuses approvals). - 403
Resource not accessible by personal access token(orby integration): GitHub's list of permissions gives this endpoint to Pull requests with write access, for a fine-grained token (see which permission to add). - Who may open one: GitHub's documentation says that to open a pull request in a public repository you need write access to the head branch, and that in a repository owned by an organization you must be a member of that organization. A repository can also turn pull requests off, let only collaborators create them, or limit them for people without write access (see pull requests turned off or limited).
- Too fast: GitHub's documentation says that creating content too quickly with this endpoint may hit a secondary rate limit, answered with 403 or 429 (see "API rate limit exceeded").
- 404: the repository is not there for this token, which is also how GitHub answers a private repository the token cannot see.
What to do
- Already exists: find it with
GET /repos/OWNER/REPO/pulls?head=OWNER:BRANCH&state=open; pushing to the branch updates that pull request. - No commits between: push the new commits first, or check that
baseis the branch you mean to merge into. - head
invalid: push the branch (git push -u origin BRANCH); from a fork, sendUSER:BRANCH, andhead_repowhen both repositories belong to one organization. - base
invalid: the name of an existing branch of this repository. - Drafts not supported: create it without
draft, ready for review. - GitHub Actions: in the repository's Settings, Actions, General, Workflow permissions, allow GitHub Actions to create and approve pull requests (in an organization, its owner may have to allow it first), or use another token.
In IntelliJ IDEA: "No changes between" and "Pull request already exists"
How the GitHub support built into IntelliJ IDEA creates a pull request, in its source (checked October 30, 2026; IntelliJ IDEA: GHPRCreateViewModel.kt, GHPRCreateComponentFactory.kt, GHPRCreationServiceImpl.kt, createPullRequest.graphql, GHAPIExceptionUtil.kt):
- Before anything is sent, it checks the two branches ("Checking pull request branches"), and Create Pull Request stays off until the check passes. "No changes between 'BASE' and 'HEAD'" comes when your local branch tracks the base branch itself, as a branch made from
origin/mainwith tracking does, whatever commits it has; or when your local repository finds no commit inBASE..HEAD, against the base branch as it was last fetched. For the first, push the branch to a branch of its own (git push -u origin BRANCH). - "Pull request already exists", with View to open it: when the head branch is on GitHub (a remote branch, or a local branch that tracks one), it asks GitHub for an open pull request with that base and head (
GET /repos/OWNER/REPO/pulls?state=open&base=BASE&head=OWNER:BRANCH). A local branch that tracks nothing is not looked up. - A local branch is pushed first when the commit on GitHub differs ("Pushing a pull request branch"); one with nothing to push to asks for a "Remote branch name:". So the head GitHub receives is already there, not one it would find
invalid. If the push fails, GitHub is not asked, and the reason is under Details. - It creates the pull request with GitHub's GraphQL API (the
createPullRequestmutation), not the REST endpoint above: base and head by branch name, withOWNER:before a head from another repository; an empty title becomes the branch name. Create Draft Pull Request is offered beside it without a check on whether the repository allows drafts. - When GitHub refuses, it reads "Failed to create a pull request", and Details shows GitHub's message for the error GraphQL returns; a token without the scopes it needs reads "User authorization failed" instead.
- Reviewers, assignees and labels are added after it is created ("Updating pull request fields"). If that step fails, the pull request is already on GitHub, though it reads the same "Failed to create a pull request"; look for it before pressing Create again.
GitHub pull requests in IntelliJ IDEA
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, creates a pull request from the branch you have checked out, into a target branch it offers from the repository's branches on GitHub as you type; a name that is not among them, or the same branch, is refused before anything is sent. When the branch is not on GitHub yet, it says so and opens the IDE's push dialog, instead of sending a head that GitHub would find invalid. When a pull request for the branch is already open, it says so, with GitHub's words; for other refusals it shows GitHub's words. A created pull request comes with a link to open it in the browser. The review inbox, diffs and conversations are free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.
More: GitHub merge refused (405, 409) · GitHub review refused (422) · GitHub search 422 "Validation Failed" · "Resource not accessible by personal access token" · 401 "Bad credentials" · "Resource protected by organization SAML enforcement" · "API rate limit exceeded" · GitHub diff 406 "too_large", 3,000 files · GitHub line comment 422 "must be part of the diff" · GitHub branch update refused (422) · GitHub auto-merge refused · GitHub draft, ready for review or close refused · GitHub conversation not resolved · GitHub checks not shown (check runs 403) · GitHub file contents not read · GitHub compare refused (404, 422) · GitHub comment or reply refused (403 locked, archived) · GitHub merge method not allowed (405) · GitHub branch not found (404, 301) · GitHub Enterprise Server not reached · GitHub review request not shown · GitHub pull request list incomplete · GitHub 404 Not Found, renamed repositories (301, 307) · GitHub line comment outdated or not on the diff · GitHub pull requests not updating, notifications late · GitHub suggested change cannot be applied · GitHub required check stuck at "Expected" · GitHub code owner review required · GitHub merge blocked by unresolved conversations · GitHub merge blocked by unsigned commits · GitHub branch that merges through a merge queue · GitHub merge waiting for an approval of the most recent push · GitHub merge waiting for code scanning results · GitHub merge waiting for code quality results · GitHub merge blocked by a code coverage threshold · GitHub merge blocked by license compliance results · GitHub branch locked or its updates restricted · GitHub branch not deleted after merging · GitHub merge waiting for a team's approval (Required reviewers) · GitHub merge blocked by secret scanning alerts · GitHub stacked pull request not merging · GitHub push blocked by push rules · GitHub merge blocked by commit metadata rules · GitHub force push blocked · GitHub issue not closed by a merged pull request · GitHub pull request not checked out locally · GitHub pull request has merge conflicts · GitHub changes requested and dismissing a review · GitHub co-author not credited for a commit · GitHub dependency review check failed · GitHub Dependabot not rebasing its pull request · GitHub fork not syncing with upstream · GitHub pull request base branch not changing · GitHub pull request not reverting · GitHub pull request template not showing · GitHub pull request labels or assignees not added · GitHub pull request not closing or reopening · GitHub push blocked by push protection · GitHub pull request comment hidden · GitHub pull request blocked until deployments succeed · GitHub team review request replaced by members · GitHub pull request file no longer marked Viewed · GitHub pull request marked merged without being merged · GitHub Copilot review does not count as an approval · GitHub checks not running on a pull request a workflow created · GitHub Update branch button not shown on a pull request · GitHub checks failing on a Dependabot pull request · GitHub checks failing on a pull request from a fork · GitHub checks skipped by [skip ci] in a commit message · GitHub checks gone after the retention period · GitHub code review limits in a public repository · GitHub pull requests turned off or limited in a repository · GitHub checks run on every pull request in a stack · GitHub pull request showing commits already squash merged · GitHub pull request not showing a file diff · GitHub push to a pull request branch from a fork refused · GitHub check cancelled on a pull request · GitHub Rebase and merge not available · GitHub merge commit message not what you expected · GitHub pull request shows every line changed · GitHub API request timed out · GitHub pull request image or document diff not shown · GitHub review request refused (422) · GitHub pull request from Copilot: checks not running, approval not counted · GitHub push refused: GH006 and GH013 on a protected branch · GitHub "At least 1 approving review is required", approvals that do not count · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語