Opening empty repository -> error 500 #3174

Closed
opened 2025-11-02 05:02:48 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @ghost on GitHub (Apr 11, 2019).

I updated to 1.8. Repositories that were in Gitea, and no commit was pushed to, produce an error 500. When I commit something to those repositories, everything works again.

  • Gitea version (or commit ref): 2551660
  • Git version:
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

...

Screenshots

Originally created by @ghost on GitHub (Apr 11, 2019). I updated to 1.8. Repositories that were in Gitea, and no commit was pushed to, produce an error 500. When I commit something to those repositories, everything works again. - Gitea version (or commit ref): 2551660 - Git version: - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [ ] Not relevant - Log gist: ## Description ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 05:02:48 -06:00
Author
Owner

@zeripath commented on GitHub (Apr 11, 2019):

Any chance you still have the logs for those 500s?

Otherwise this is likely to be impossible to debug as I'm not certain how to go about replicating it.

@zeripath commented on GitHub (Apr 11, 2019): Any chance you still have the logs for those 500s? Otherwise this is likely to be impossible to debug as I'm not certain how to go about replicating it.
Author
Owner

@ghost commented on GitHub (Apr 11, 2019):

@zeripath What I found is the following error which belongs to this behaviour:

2019/04/03 16:47:25 [...ules/context/repo.go:580 func1()] [E] GetBranches: No branches in non-empty repository XXXXXXXXXXXXXXXX.git
2019/04/03 16:47:25 [D] Template: status/500
@ghost commented on GitHub (Apr 11, 2019): @zeripath What I found is the following error which belongs to this behaviour: ``` 2019/04/03 16:47:25 [...ules/context/repo.go:580 func1()] [E] GetBranches: No branches in non-empty repository XXXXXXXXXXXXXXXX.git 2019/04/03 16:47:25 [D] Template: status/500 ```
Author
Owner

@zeripath commented on GitHub (Apr 11, 2019):

This is quite interesting, because the only way this can happen is if the repository is actually empty according to git.

So is it that these were empty repositories which were previously marked as "bare" and have not migrated correctly as empty repositories into 1.8?

@zeripath commented on GitHub (Apr 11, 2019): This is quite interesting, because the only way this can happen is if the repository is actually empty according to git. So is it that these were empty repositories which were previously marked as "bare" and have not migrated correctly as empty repositories into 1.8?
Author
Owner

@ghost commented on GitHub (Apr 12, 2019):

@zeripath Those repositories were created with Gitea 1.7 and never used before. But I could open the repository page in the browser. After upgrading to Gitea 1.8 this was no longer possible, since I get the 500 error. Unfortunately I have no other old empty repository. The solution for me was to commit just something and Gitea worked again.

@ghost commented on GitHub (Apr 12, 2019): @zeripath Those repositories were created with Gitea 1.7 and never used before. But I could open the repository page in the browser. After upgrading to Gitea 1.8 this was no longer possible, since I get the 500 error. Unfortunately I have no other old empty repository. The solution for me was to commit just something and Gitea worked again.
Author
Owner

@zeripath commented on GitHub (Apr 12, 2019):

Hmm. Were they created in an RC of 1.7? Basically the only way this should have happened is if your db was one of the ones that didn't properly undergo migration v78.

If so I think this is probably a wontfix as it shouldn't happen in normal practice - although I do think that we should consider removing the is_empty columns from our tables and make our code robust enough to cope with situations like this. (This sort of just redirect to 500 with an impenetrable error is very annoying behaviour which we should try to handle better.)

Thank you for your report and continued use of Gitea.

@zeripath commented on GitHub (Apr 12, 2019): Hmm. Were they created in an RC of 1.7? Basically the only way this should have happened is if your db was one of the ones that didn't properly undergo migration v78. If so I think this is probably a wontfix as it shouldn't happen in normal practice - although I do think that we should consider removing the is_empty columns from our tables and make our code robust enough to cope with situations like this. (This sort of just redirect to 500 with an impenetrable error is very annoying behaviour which we should try to handle better.) Thank you for your report and continued use of Gitea.
Author
Owner

@ghost commented on GitHub (Apr 13, 2019):

@zeripath I used the Docker image with 1.7 label from the beginning. I guess there is a good chance I started with a RC. Good to know this was already fixed. Thank you.

@ghost commented on GitHub (Apr 13, 2019): @zeripath I used the Docker image with 1.7 label from the beginning. I guess there is a good chance I started with a RC. Good to know this was already fixed. Thank you.
Author
Owner

@alneo commented on GitHub (Aug 19, 2019):

2019/08/19 15:39:03 ...ules/context/repo.go:594:func1() [E] GetBranches: No branches in non-empty repository XXXXXX
I did an update from 1.7.4 to 1.8.3 and 1.9.1 and in some repositories I get a 500 error
files exist along the path gitea-repositories
How to restore repositories?

@alneo commented on GitHub (Aug 19, 2019): 2019/08/19 15:39:03 ...ules/context/repo.go:594:func1() [E] GetBranches: No branches in non-empty repository XXXXXX I did an update from 1.7.4 to 1.8.3 and 1.9.1 and in some repositories I get a 500 error files exist along the path gitea-repositories How to restore repositories?
Author
Owner

@jackTheStark commented on GitHub (Jan 23, 2020):

I am getting the same issue, I restored from linux-service v1.1.0 to docker v1.10.3.

When looking through the logs, this is what if found.
...ules/context/repo.go:627:func1() [E] GetBranches: No branches in non-empty repository /data/git/repositories/evo/digital_marketing.git

@jackTheStark commented on GitHub (Jan 23, 2020): I am getting the same issue, I restored from linux-service v1.1.0 to docker v1.10.3. When looking through the logs, this is what if found. `...ules/context/repo.go:627:func1() [E] GetBranches: No branches in non-empty repository /data/git/repositories/evo/digital_marketing.git`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3174