Opening empty repository -> error 500 #3811

Closed
opened 2025-11-02 05:26:06 -06:00 by GiteaMirror · 15 comments
Owner

Originally created by @alneo on GitHub (Aug 19, 2019).

  • Gitea version (or commit ref): 1.9.1
  • 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:
    2019/08/19 16:18:03 ...ules/context/repo.go:594:func1() [E] GetBranches: No branches in non-empty repository /gitea-repositories/xxxxxxxx/xxxxxxxxxxx
    2019/08/19 16:18:03 ...s/context/context.go:137:HTML() [D] Template: status/500

Description

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?

Screenshots

Originally created by @alneo on GitHub (Aug 19, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.1 - Git version: - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: 2019/08/19 16:18:03 ...ules/context/repo.go:594:func1() [E] GetBranches: No branches in non-empty repository /gitea-repositories/xxxxxxxx/xxxxxxxxxxx 2019/08/19 16:18:03 ...s/context/context.go:137:HTML() [D] Template: status/500 ## Description 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? ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the issue/stale label 2025-11-02 05:26:06 -06:00
Author
Owner

@typeless commented on GitHub (Aug 20, 2019):

If you can open the settings page of the repository, try to select a default branch.

Edit:
The related code is at https://github.com/go-gitea/gitea/blob/release/v1.9/modules/context/repo.go#L592.

I don't know why it would be a branchless repository.
What would you see by typing GIT_DIR=/gitea-repositories/xxxxxxxx/xxxxxxxxxxx git branch -a at your command line?

@typeless commented on GitHub (Aug 20, 2019): If you can open the settings page of the repository, try to select a default branch. Edit: The related code is at https://github.com/go-gitea/gitea/blob/release/v1.9/modules/context/repo.go#L592. I don't know why it would be a branchless repository. What would you see by typing `GIT_DIR=/gitea-repositories/xxxxxxxx/xxxxxxxxxxx git branch -a` at your command line?
Author
Owner

@abread commented on GitHub (Aug 22, 2019):

Happened to me as well. I'm not sure if it was introduced in 1.8 or 1.9.
Settings are inacessible and there are indeed no branches.

A branch is just a "pointer" to a commit, so until something is commited no branches actually exist

@abread commented on GitHub (Aug 22, 2019): Happened to me as well. I'm not sure if it was introduced in 1.8 or 1.9. Settings are inacessible and there are indeed no branches. A branch is just a "pointer" to a commit, so until something is commited no branches actually exist
Author
Owner

@lunny commented on GitHub (Aug 23, 2019):

@abread how did you create that repository on gitea?

@lunny commented on GitHub (Aug 23, 2019): @abread how did you create that repository on gitea?
Author
Owner

@abread commented on GitHub (Aug 23, 2019):

Just the regular create button, without initializing it. At least one with 1.7.x/1.8.x, the others with older versions.

On August 23, 2019 2:40:39 AM UTC, Lunny Xiao notifications@github.com wrote:

@abread how did you create that repository on gitea?

--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/go-gitea/gitea/issues/7914#issuecomment-524150235

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

@abread commented on GitHub (Aug 23, 2019): Just the regular create button, without initializing it. At least one with 1.7.x/1.8.x, the others with older versions. On August 23, 2019 2:40:39 AM UTC, Lunny Xiao <notifications@github.com> wrote: >@abread how did you create that repository on gitea? > >-- >You are receiving this because you were mentioned. >Reply to this email directly or view it on GitHub: >https://github.com/go-gitea/gitea/issues/7914#issuecomment-524150235 -- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Author
Owner

@typeless commented on GitHub (Aug 23, 2019):

Can you query the database for the is_empty column of the repo table?
This column has been migrated from is_bare recently.
The index would probably need to be re-generated.

As per https://github.com/go-gitea/gitea/blob/master/modules/context/repo.go#L563.
It should return from the function normally if the repo is empty.

@typeless commented on GitHub (Aug 23, 2019): Can you query the database for the `is_empty` column of the `repo` table? This column has been migrated from `is_bare` recently. The index would probably need to be re-generated. As per https://github.com/go-gitea/gitea/blob/master/modules/context/repo.go#L563. It should return from the function normally if the repo is empty.
Author
Owner

@abread commented on GitHub (Aug 23, 2019):

That seems to be the issue is_empty is NULL on all repositories except the ones that are not empty and were visited, which are 0.

@abread commented on GitHub (Aug 23, 2019): That seems to be the issue `is_empty` is `NULL` on all repositories except the ones that are not empty and were visited, which are `0`.
Author
Owner

@stale[bot] commented on GitHub (Oct 22, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Oct 22, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@nuno-silva commented on GitHub (Oct 22, 2019):

Please don't close.

@nuno-silva commented on GitHub (Oct 22, 2019): Please don't close.
Author
Owner

@zeripath commented on GitHub (Oct 22, 2019):

@nuno-silva are you still suffering this? What version of Gitea are you using?

Have you tried setting the values of is_bare manually?

@zeripath commented on GitHub (Oct 22, 2019): @nuno-silva are you still suffering this? What version of Gitea are you using? Have you tried setting the values of is_bare manually?
Author
Owner

@nuno-silva commented on GitHub (Oct 22, 2019):

@zeripath yes, I have one repo (laboratorios) still affected, using:

  • gitea 1.9.3
  • Go1.12.8

The repository has no commits (yet).

MariaDB [gitea]> select id,lower_name,is_bare,is_mirror,is_fork,is_empty,is_archived from repository where lower_name like 'laboratorios' or lower_name like 'testing123';
+-----+--------------+---------+-----------+---------+----------+-------------+
| id  | lower_name   | is_bare | is_mirror | is_fork | is_empty | is_archived |
+-----+--------------+---------+-----------+---------+----------+-------------+
| 484 | laboratorios |       1 |         0 |       0 |     NULL |        NULL |
| 584 | testing123   |    NULL |         0 |       0 |        1 |           0 |
+-----+--------------+---------+-----------+---------+----------+-------------+
2 rows in set (0.00 sec)

If I create a new repo (testing123) it works.

note: this is the same gitea instance as @abread .

edit: testing on a new repo

@nuno-silva commented on GitHub (Oct 22, 2019): @zeripath yes, I have one repo (`laboratorios`) still affected, using: - gitea 1.9.3 - Go1.12.8 The repository has no commits (yet). ``` MariaDB [gitea]> select id,lower_name,is_bare,is_mirror,is_fork,is_empty,is_archived from repository where lower_name like 'laboratorios' or lower_name like 'testing123'; +-----+--------------+---------+-----------+---------+----------+-------------+ | id | lower_name | is_bare | is_mirror | is_fork | is_empty | is_archived | +-----+--------------+---------+-----------+---------+----------+-------------+ | 484 | laboratorios | 1 | 0 | 0 | NULL | NULL | | 584 | testing123 | NULL | 0 | 0 | 1 | 0 | +-----+--------------+---------+-----------+---------+----------+-------------+ 2 rows in set (0.00 sec) ``` If I create a new repo (`testing123`) it works. note: this is the same gitea instance as @abread . edit: testing on a new repo
Author
Owner

@holmesb commented on GitHub (Oct 22, 2019):

In my case, the problem was a mismatch between the port memcached was listening on and app.ini setting:

[cache]
HOST     = 127.0.0.1:<PORT>
@holmesb commented on GitHub (Oct 22, 2019): In [my case](https://github.com/go-gitea/gitea/issues/8023), the problem was a mismatch between the port memcached was listening on and app.ini setting: ``` [cache] HOST = 127.0.0.1:<PORT> ````
Author
Owner

@zeripath commented on GitHub (Oct 22, 2019):

Just set the is_empty value to the correct thing for that repo and it will never happen again. You suffered a migration bug when changing versions - that migration is now fixed and should never happen again.

Edit: mistake in value

@zeripath commented on GitHub (Oct 22, 2019): Just set the is_empty value to the correct thing for that repo and it will never happen again. You suffered a migration bug when changing versions - that migration is now fixed and should never happen again. Edit: mistake in value
Author
Owner

@nuno-silva commented on GitHub (Oct 22, 2019):

@zeripath alright. You mean set is_empty, right (as @zeripath said)?. That works. Thank you!

@nuno-silva commented on GitHub (Oct 22, 2019): @zeripath alright. You mean set `is_empty`, right (as @zeripath said)?. That works. Thank you!
Author
Owner

@stale[bot] commented on GitHub (Dec 21, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Dec 21, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Jan 4, 2020):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Jan 4, 2020): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3811