Forgejo and Gitea: 404 "The target couldn't be found." and "not found"
The server gives the same 404 for a repository that does not exist and for one that exists but that you may not see. In the source of both Forgejo and Gitea, the API first finds the repository, then checks your access to it, and without any access it answers "not found", exactly as for a missing one. So a private repository, read without a token or with a token whose account has no access, looks like a repository that is not there. Check the token first, then the address.
What each server says
Asked on October 24, 2026. Codeberg (Forgejo 16) and code.forgejo.org (Forgejo 17), for a repository that is missing (and, by the source, for one that you may not see):
HTTP/1.1 404 Not Found
{"message":"The target couldn't be found.","url":"https://codeberg.org/api/swagger","errors":[]}
The same servers, when not even the owner (the user or organization in the path) exists:
{"message":"GetUserByName","url":"https://codeberg.org/api/swagger","errors":["user redirect does not exist [name: no-such-owner]"]}
gitea.com, in both cases:
{"message":"not found","url":"https://gitea.com/api/swagger"}
Your own server may word it differently by version; the 404 is the same. To check the repository with your token:
curl -i -H "Authorization: token your-token" https://codeberg.org/api/v1/repos/OWNER/REPO
200 with the repository means the token can see it. Use your own server's address instead of codeberg.org.
When the repository is there
- No token was sent. Without one, only public repositories can be read.
- The token's account has no access. The account needs access to the repository, for example as a collaborator or through a team of the organization. A token never gets more than its account has.
- The token lacks the repository scope. That is refused with 403 instead: "token does not have at least one of required scope(s)".
When the address is wrong
The API path is /api/v1/repos/OWNER/REPO, with the owner and the repository's name as they appear in the clone address. Forgejo's GetUserByName answer says that already the owner part is unknown on this server: a typo in the user or organization, or a repository that lives on another server.
Renamed or transferred repositories
From the source of both Forgejo and Gitea: when no repository has the requested name, the server looks for a redirect left by a rename.
- A renamed repository, or one transferred to another owner: the old path answers 301 Moved Permanently with the new path in
Location, whatever the request. - A renamed user or organization: the old name answers 307 Temporary Redirect to the new name.
A client that follows redirects reads the repository through the old address, so a clone with the old address can seem to work. A request that changes something gets the 301 instead, unless the client sends it again to the new address. Point the clone at the new address:
git remote set-url origin https://codeberg.org/NEW-OWNER/NEW-NAME.git
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, keeps one token for Codeberg and one for your own server, each in the IDE's password safe and sent only to its own server. Without a token it reads public repositories. When the server answers 404 for the repository, the plugin says, without a token, that the repository is private or does not exist and offers its settings to add one; with a token, that the server has no repository at that path that the token can open, and to check the address and the account's access. Opened from a clone with a renamed or transferred repository's old address, it follows the server's redirect to the new one: for reading, and from version 1.0.13 for approving, commenting and merging too, on the same server only (the token never goes to another host). 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: 401 "token is required" and unknown tokens · "token does not have at least one of required scope(s)" · Forgejo and Gitea merge refused (405, 409) · Forgejo and Gitea review refused (422) · Forgejo and Gitea branch update refused (403, 409, 422) · 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 · 日本語