Lesstep
Forgejo · Gitea · Codeberg · create pull request API · Checked October 24, 2026

Forgejo and Gitea: why the pull request was not created

Creating a pull request through the API (POST /api/v1/repos/OWNER/REPO/pulls with head, base and title) is refused with 409, 422, 404 or 403. All of this is from the source of both (CreatePullRequest and parseCompareInfo in routers/api/v1/repo/pull.go, and NewPullRequest in services/pull/pull.go), read on October 24, 2026.

The answers

A token without permission to write to repositories 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 repository that does not exist, or that you cannot see, answers 404 as well; see missing, private or renamed.

Where it stands

curl -H "Authorization: token your-token" https://codeberg.org/api/v1/repos/OWNER/REPO/pulls/main/feature

This answers a pull request from feature into main, or 404 when there has never been one. In the source it does not pick only open ones, so look at state and number: the open one is the one the 409 means. To see whether the server has the branch, …/repos/OWNER/REPO/branches/feature answers 404 when it does not. Use your own server's address instead of codeberg.org.

What to do

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, creates a pull request from the branch you are on. When the server does not have the branch yet, it offers to push it first; it does not accept the same branch as the target; and when the server answers 409, it says that a pull request for this branch is already open, with the server's words. For 403, it says that your permissions in the repository or its branch protection may not let your account do it, with the server's words; other refusals in the server's words. Reading is free; creating, 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 review refused (422) · Forgejo and Gitea branch update refused (403, 409, 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 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 · 日本語