GitHub: why auto-merge was refused
Auto-merge makes GitHub merge a pull request by itself once the required reviews and status checks pass. It is turned on with the GraphQL mutation enablePullRequestAutoMerge, which takes the pull request's id and optionally mergeMethod, commitHeadline, commitBody, authorEmail and expectedHeadOid (the head you expect). GitHub's documentation does not list the refusals; the ones below are quoted from public reports, with GitHub's documented rules behind them (checked October 25, 2026).
mutation {
enablePullRequestAutoMerge(input: {pullRequestId: "PR_…", mergeMethod: SQUASH}) {
clientMutationId
}
}
What GitHub says, and why
Pull request Pull request is in clean status(GitHub writes "Pull request" twice): the pull request can be merged now. GitHub's documentation says the option is offered only on pull requests that cannot be merged immediately, for example while the branch's rules wait for reviews or status checks. In GitHub's schema,CLEANis "mergeable and passing commit status".Pull request Pull request is in unstable status:UNSTABLEis "mergeable with non-passing commit status": some checks fail, but none that the rules require, so the pull request can be merged now and there is nothing for auto-merge to wait for.Auto merge is not allowed for this repository: the repository's Allow auto-merge setting is off. GitHub's documentation says auto-merge must be allowed for the repository first; on a branch that requires a merge queue, that setting does not apply, and Merge when ready turns auto-merge on even when the repository does not allow it.Pull request Protected branch rules not configured for this branch: the base branch has no rule that holds the merge back, so there is nothing to wait for. A public report fixed it by adding a rule to the base branch, such as Require a pull request before merging.Resource not accessible by integration, from a workflow'sGITHUB_TOKEN: public reports found thatpull-requests: writealone was not enough, and thatcontents: writelet the workflow turn auto-merge on.- Who may: GitHub's documentation says that people with write permissions to the repository can turn auto-merge on.
Turned on, then off again
- GitHub's documentation says auto-merge is turned off when someone without write permissions pushes to the head branch, or when the base branch is switched.
- People with write permissions and the pull request's author can turn it off.
- On a branch that requires a merge queue, GitHub's schema says the merge method and the commit message given to the mutation are ignored.
What to do
- Clean, or unstable: merge it now, or wait for the checks you care about first.
- Not allowed for this repository: in the repository's Settings, General, Pull Requests, select Allow auto-merge.
- No rules on the branch: add a rule to the base branch that requires reviews or status checks, or merge it yourself once it is ready.
- A workflow: give its job
contents: writeandpull-requests: write. - A refused merge rather than auto-merge: see why GitHub refused the merge.
In IntelliJ IDEA: no auto-merge, and Merge… is on when the pull request can be merged now
How the GitHub support built into IntelliJ IDEA handles a pull request that cannot be merged yet, in its source (checked October 31, 2026; IntelliJ IDEA: GraphQL files, GithubApiRequests.kt, GHPullRequestMergeStateStatus.kt, GHPRMergeabilityStateBuilder.kt, GHPRReviewFlowViewModelImpl.kt):
- No auto-merge: none of its 78 GraphQL files, the 20 mutations among them, mentions auto-merge, and none of its REST requests does. So the IDE neither turns auto-merge on or off nor reads whether it is on; that is done on GitHub.
- When Merge… and Squash and Merge… are on: when GitHub's
mergeStateStatusisCLEAN,HAS_HOOKSorUNSTABLE, that is, when the pull request can be merged now, which includes the clean and unstable states in which GitHub refuses auto-merge above. While it isBLOCKEDorBEHIND, they are on only for an account with Admin permission and only when GitHub returns a rule for the target branch, and the merge is then sent right away, not held until the rules are met. In the other states they stay off, so there is nothing in the IDE that waits for the reviews or checks. For the other conditions of the buttons, see Rebase and merge is not available.
GitHub pull requests in IntelliJ IDEA
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, offers Merge automatically once the requirements are met in its merge dialog only while GitHub holds the merge back (the branch's rules not met yet, or new commits on the target branch), and not when the repository has turned auto-merge off; a pull request GitHub could merge now gets the merge itself. It turns auto-merge on with the merge method and commit message from the dialog, and says that the pull request will be merged once its requirements are met. When GitHub refuses, it shows GitHub's words; for a token without the permission, it points to Settings. 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 pull request not created (422, 403) · 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 · 日本語