mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-09 21:10:00 -05:00
Error - FindRecentlyPushedNewBranches, branch does not exist [repo_id: 64 name: main] #13065
Closed
opened 2025-11-02 10:29:06 -06:00 by GiteaMirror
·
46 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16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.4.0-rc2
v1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#13065
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Flagelmann on GitHub (May 29, 2024).
Description
I'm getting a weird issue on several repositories.
The actual error is a 500 error:
FindRecentlyPushedNewBranches, branch does not exist [repo_id: 64 name: main]How to solve this? Should I modify the branch name directly on DB side? Is there any way to fix this from the Gitea web portal?
Actually, it seems that this new version has broken several repos at once. Until last week everything was good, clean and accessible. Now I'm getting this error on several repositories.
Gitea Version
1.22.0
Workaround
It has been fixed in 1.22-nightly (which will be 1.22.1 soon), please use the 1.22-nighly binary (https://dl.gitea.com/gitea/1.22-nightly/) or docker image.
@lunny commented on GitHub (May 29, 2024):
Please try to run
sync brancheson admin panel.@Flagelmann commented on GitHub (May 29, 2024):
Yout mean the "Resynchronize pre-receive, update and post-receive hooks of all repositories."?
I have already tried multiple times it....nothing changed.
I also tried "Reinitialize all missing Git repositories for which records exist" under "Site Administration", nothing even with this.
I wish I will not have to rebuild the gitea instance from scratch.....so, re-import manually over 100 repositories (over 30 GB of data) and then also re-enable manually, by modifying manually each repository on database side the mirroring settings for each repo I have (as Gitea does not still have the way to backup these settings)....
@wxiaoguang commented on GitHub (May 29, 2024):
I do not think
FindRecentlyPushedNewBrancheslogic is right. Anything wrong in that function shouldn't block end users seeing a complete page.@lunny commented on GitHub (May 29, 2024):
No. It's
Sync missed branches from git data to databases@Flagelmann commented on GitHub (May 29, 2024):
I get, not for all repositories (fortunately), a Gitea error page with a big "500" at center page and then, just below, the message:
Nothing else.
@Flagelmann commented on GitHub (May 29, 2024):
Even with "Sync missed branches from git data to databases" nothing changed. It starts, but then nothing...
@lunny commented on GitHub (May 29, 2024):
The sync will take some times, maybe you need to wait for a while and refresh the page again.
@wxiaoguang commented on GitHub (May 29, 2024):
As a quick fix: Ignore FindRecentlyPushedNewBranches err #31164
If you could build your own instance, you could try to apply it to 1.22 branch.
Or when the backport is done and 1.22-nightly is ready, please try 1.22 nightly.
@Flagelmann commented on GitHub (May 29, 2024):
I am using snapcraft to deploy and get updates of Gitea.
May I get the nightly build with snap or do I have just to wait the next build?
@yp05327 commented on GitHub (May 30, 2024):
As a quick fix it is ok, but I think the root reason is that sync branch has some problems.
The branch name is
main, so it is default branch of repo 64?Then what kind of this repo is? A fork, a mirror or a normal one?
Then why this branch can not be found in DB? During the creation of this repo, the main branch should has been insert into the DB.
@wxiaoguang commented on GitHub (May 30, 2024):
Reopen, because the quick fix isn't complete. Need to figure out the root reason.
@wxiaoguang commented on GitHub (May 30, 2024):
The root problem is that any branch could be renamed or deleted. Default branch may not exist in many cases.
So when running
FindRecentlyPushedNewBranches, any non-existing branch should be ignored, but not reporting an error.@yp05327 commented on GitHub (May 30, 2024):
I can only image one case that the last branch (it is also the default branch) was deleted, and there's no branch in the repo, this error would happen.
If the default branch is renamed, repo.DefaultBranch should also be renamed?
If there's two or more branches, then when the default branch was deleted, the other one will be the new default branch?
@Flagelmann commented on GitHub (May 30, 2024):
Jfyi, I have fixed the issue by issuing a simple UPDATE query against the specific repository ID in the repository table, updating the default_branch value from "main" to "master". Just after doing that now I can access the affected repository.
I will have to check all of them one by one, as not all repository are using the "master" branch, some are using "main".
Here a sample query I used:
UPDATE repository SET default_branch = 'master' WHERE id = 100;
Finally, I dunno why this happened, as just before the upgrade to the latest build I was able to use the affected repositories without issues (and they were on master branch, not main, and I checked it in the commit history); after the upgrade several repositories have been "moved" to the main branch without a reason.
Wishing that this will not happen anymore in the next builds.
Regards
@lunny commented on GitHub (May 30, 2024):
Maybe the algorithm of detection defulat branch when syncing branches into database are wrong. So that, all repositories with
masteras default branch but your default branch in app.ini ismainwill be wrong.@Flagelmann commented on GitHub (May 30, 2024):
Probably, for now I have reverted manually, as it was the only way to fix this without disruptions, each repository affected from the wrong default branch to the correct one (master, most of the times).
But now I'm a bit worried about next builds/updates. :D
@lunny commented on GitHub (May 30, 2024):
You don't need to worry about next update. Syncing branches to database is a new infrastructure refactor of 1.22. It should only do increment sync after the first sync for every repository.
Can you confirm only repositories with default branch
masterwere affected?@Flagelmann commented on GitHub (May 30, 2024):
No, actually there was even another repository that was not on master (still figuring out which was the previous one) but it was put on main also.
UPDATE: ok, the other repository was on "dev" as default branch name but it was also put to "main". Now reverted and I can access it again.
@spiritLHLS commented on GitHub (May 30, 2024):
I'm having the same problem, hopefully the next new release fixes this and does it automatically (since my gitea is mainly used for backups, there are too many affected repositories for me to have the time to detect and manually fix them all).
@Flagelmann commented on GitHub (May 30, 2024):
Well, I checked the 180+ repositories I have right now on my Gitea instance and I would say that 1/3 of them have been affected by this issue. Now I have fixed them, but obviously I will monitor after next update if this will happen again.
@eeyrjmr commented on GitHub (May 30, 2024):
This is what I faced as well, luckily only one ...
In my case it was something a little bit low-level such that the one repo facing this appeared to have two origin/master and even cli got had a warning (gitea just 500 on the code page as it didn't have a default)
@Flagelmann commented on GitHub (May 30, 2024):
Lucky one :D
In my case, not a lot of repos have multi-branches, but only master, so after this sudden "mass-rename/sync" I got a lot of these repos basically unreachable due to the fact that the only existant branch, master, was "renamed" to main on DB level, so nothing could be retrieved.
@eeyrjmr commented on GitHub (May 30, 2024):
I wonder if it is all the same issue (from gitea perspective).
Basically gitea was unable to find the default branch (master or main) and hence a 500 page. If you append /issue to the URL you get to the other webUI of gitea and from there you can view branches etc. for me it was not showing master (only the other feature branches )
A git clone works and git remote -r would list the feature branches but I also had what appeared as two origins and git would provide a WARNING (while this was an ERROR for gitea).
If you Google around you will find this can occur with git and it tolerates it but gitea needs to be a bit more deterministic especially with the db sinking
My workaround was to create a new branch from the cli from what git considered master, remove the master branches (local and origin), push to origin, from gitea /issue page then change the default branch to the new branch and everything works. Finally rename this tmp branch to master
Obviously this is a tedious workaround to get the git repo in alignment so the question then is.. what should gitea do and what is causing these shadow branches
@Flagelmann commented on GitHub (May 30, 2024):
I did not know about the /issue URL part. Good to know.
Probably this is just a Gitea-side issue as I checked, in my case, and the git repos were still there untouched, but not visible.
Actually in my case it was much quicker to identify which was the wrong value on DB side and update it directly for all the affected repo IDs.
@Cat7373 commented on GitHub (May 31, 2024):
I also encountered this problem, after upgrading to 1.22.0
@wxiaoguang commented on GitHub (May 31, 2024):
Please try 1.22-nightly , and/or try to "Sync branches" from the admin dashboard panel
@yp05327 commented on GitHub (Jun 3, 2024):
Maybe this is caused by auto renaming branch name

After the renaming, the branch name in DB is not changed
But this could be fixed by sync branches. 🤔
After I sync branches, it worked.
@yp05327 commented on GitHub (Jun 3, 2024):
Does this related to #28056 ?
User didn't notice this issue, so branches are not synced since updated to v1.21, and errors occurred after upgrade to v1.22?
@Flagelmann commented on GitHub (Jun 3, 2024):
Actually in my case it was not due to an auto-renaming of the branches, as I had, suddenly after the auto-upgrade (using snap image) 40-50 repositories not usable anymore using Gitea, then I fixed each of them directly in DB and after the value updated on DB side I did just an F5 on the page of the affected repo and it turned back working as expected.
Also, on https://github.com/go-gitea/gitea/issues/28056 the error was about LoadBranches while in this case I got FindRecentlyPushedNewBranches.
Obviously I tried several times the "Sync Branches" but it was completely useless (nothing fixed with that function).
@theAkito commented on GitHub (Jun 20, 2024):
100% agree with OP. Same experience here.
@wxiaoguang commented on GitHub (Jun 20, 2024):
It has been fixed in 1.22-nightly (which will be 1.22.1 soon), please use the 1.22-nighly binary (https://dl.gitea.com/gitea/1.22-nightly/) or docker image.
@theAkito commented on GitHub (Jun 20, 2024):
Ah, I see, I thought it would be backported into the 1.22 branch.
Is this Nightly release production ready or would it be rather advisable to wait for 1.22.1?
Is there a release date for 1.22.1?
@wxiaoguang commented on GitHub (Jun 20, 2024):
Yes, it has been backported to 1.22, so 1.22-nightly contains it.
Yes, because 1.22-nighty will be 1.22.1 soon. It is exactly for production so no need to wait.
Maybe in a several days.
@theAkito commented on GitHub (Jun 20, 2024):
@wxiaoguang
Which branch or commit do I need to check out from Git to get exactly the state of
1.22-nightly? I want to build my own Docker image.@delvh commented on GitHub (Jun 20, 2024):
release/1.22@delvh commented on GitHub (Jun 20, 2024):
(± one day as
nightlyis probably built only once a day as the name implies)@theAkito commented on GitHub (Jun 20, 2024):
Nice, seems to work now and the issue is worked around. Thank you!
@delvh commented on GitHub (Jun 23, 2024):
The issue seems to be fixed.
@yp05327 commented on GitHub (Jun 23, 2024):
The root reason is not fixed.
We have some unknown issues about sync branch to DB.
@theAkito commented on GitHub (Jun 24, 2024):
@yp05327 I agree.
I even specifically said
because it is not fixed. 😄
@wxiaoguang commented on GitHub (Jun 24, 2024):
I believe the root problem needs a new issue to clarify the details, but not keeping discussing "FindRecentlyPushedNewBranches" here .....
The FindRecentlyPushedNewBranches bug is indeed fixed, it sounds like a workaround but the approach is right: to make the system robust. No matter there is the root problem or not, the fix is still right and necessary.
(And see my comment above: https://github.com/go-gitea/gitea/issues/31163#issuecomment-2138581805 the default branch may not exist in some cases)
@lunny commented on GitHub (Jun 24, 2024):
Let's open a new issue.
@theAkito commented on GitHub (Jun 24, 2024):
Which is it? I don't see a related new issue in the list.
I'll create a new one, then.
Here it is.
@amirad1 commented on GitHub (Aug 10, 2024):
It seems in the 1.22.1 version, the 500 error is fixed but I still get the error log ? should I ignore it or not ?
@lunny commented on GitHub (Aug 10, 2024):
Please open a new issue and paste your error logs.
@wxiaoguang commented on GitHub (Aug 10, 2024):
@lunny you have asked so above https://github.com/go-gitea/gitea/issues/31163#issuecomment-2185600813 and there is already one https://github.com/go-gitea/gitea/issues/31163#issuecomment-2185951268 : #31471