Forgejo and Gitea: why the branch update was refused
"Update branch" (POST /api/v1/repos/OWNER/REPO/pulls/NUMBER/update, by merge, or with ?style=rebase by rebase) brings the target branch's new commits into the pull request's branch. All of this is from the source of both (UpdatePullRequest in routers/api/v1/repo/pull.go and services/pull/update.go), read on October 24, 2026, including the Gitea releases where it changed.
The answers
- 403 with no message at all: your account may not update this branch in this style (see below). The body is empty, so nothing says which rule refused it.
merge failed because of conflict,rebase failed because of conflict(409): the target branch's new commits conflict with the pull request's. The branch was not changed.- 422 for a closed or merged pull request: Gitea 1.27 and later say
pull request is already closedorpull request is already merged. Forgejo and Gitea up to 1.26 answer the same 422 with the message%!s(<nil>): in their source, the error handed to the answer is empty, so the message is Go's placeholder for "nothing", not a clue. - Already up to date (the branch already has the target branch's commits): Forgejo answers 200 and changes nothing. Gitea answers 500, and on a server in production mode the message is empty unless you are one of its administrators, who see
HeadBranch of PR 42 is up to date.
A token that may only read is refused with 403 too, but that answer says token does not have at least one of required scope(s); see which permission to add. A pull request number that does not exist answers 404; see missing, private or renamed.
Who may update, and how
By merge (the default), the server lets you update when either holds:
- you may push to the pull request's branch: write access to the repository it comes from (often a fork), within that branch's protection rule if it has one; or
- its author left Allow edits from maintainers on, and you may merge in the target repository.
Gitea 1.27 and later also need the target repository's setting Enable updating pull request branch by merge.
By rebase, the update is refused when:
- the target repository's setting Enable updating pull request branch by rebase is off;
- on Forgejo and Gitea up to 1.22, the pull request's branch has a protection rule (a rebase needs a force push);
- on Gitea 1.23 and later, you may not force-push to that branch.
A pull request made with AGit (pushed to refs/for/… instead of from a branch) cannot be updated this way: 403.
Where it stands
curl -H "Authorization: token your-token" https://codeberg.org/api/v1/repos/OWNER/REPO/pulls/42
When merge_base differs from base.sha, the target branch has commits that the pull request's branch does not. allow_maintainer_edit says whether its author allowed edits from maintainers. Use your own server's address instead of codeberg.org.
What to do
- 409 conflicts: in a clone, merge or rebase the target branch into the pull request's branch, resolve the conflicts, and push.
- 403: ask the author to allow edits from maintainers, or ask someone who may push to the branch. If only the rebase is refused, update by merge.
- 422: refresh: the pull request is closed or merged now.
- Gitea's 500 right after someone else updated it: read the pull request again. If
merge_baseequalsbase.sha, there is nothing left to update.
Forgejo and Gitea pull requests in IntelliJ IDEA
Pull Request Inbox for Forgejo and Gitea, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows among a pull request's merge checks when the target branch has new commits, with a link to update the branch by merge. When the server refuses, it says so: for 403, that your permissions in the repository or its branch protection may not let your account do it; for conflicts, the server's words. From version 1.0.15, when the pull request was closed or merged in the meantime, it says so instead of "%!s(<nil>)", and on Gitea, when there is nothing left to bring in, that the branch already has the target branch's new commits. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
Forgejo, Gitea and Codeberg are names of their respective owners; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by the Forgejo project, Codeberg e.V., the Gitea project or JetBrains.
More: Forgejo and Gitea merge refused (405, 409) · Forgejo and Gitea merge when checks succeed refused (405, 409, 500) · Forgejo and Gitea review refused (422) · "token does not have at least one of required scope(s)" · 401 "token is required" and unknown tokens · 404 "The target couldn't be found." and "not found" · Forgejo and Gitea pull request not created (409, 422, 403) · Forgejo and Gitea comment refused (403, 422, 400) · Forgejo and Gitea search refused (400, 422) · Forgejo and Gitea pull request files (pages of 50, changed_files) · Forgejo and Gitea pull request plugins for IntelliJ IDEA, compared · 日本語