Error 500 when accessing branches in repo #12686

Closed
opened 2025-11-02 10:18:08 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @davama on GitHub (Mar 20, 2024).

Description

Good Day,

Hope I've posted all relevant info.

We have a repo inside an org, which does not allow us to view its branches via the UI. We had several branches that were automatically created with our pipeline via the API. We've been doing this for several months now. Only yesterday we noticed that we could not see the branches in the UI (this was never the case before). We were under version 1.21.7 and were hoping updating to 1.21.8 would help, but nothing.

Since we could see all the branches via the API, we decided to delete all the branches via API except for main. Now only main shows via the API. Interestingly under the UI, it still shows that 2 Branches exists. (see screenshots)

When i click on the tto-device-discovery branch, i get a 404 not found code page, which should be correct (see screenshot)

Looking at other tickets, i check permissions on the filesystem, but nothing interesting

git-1:/data/git/repositories/sot/netbox-sot.git$ pwd
/data/git/repositories/sot/netbox-sot.git
git-1:/data/git/repositories/sot/netbox-sot.git$ ls -al
total 196
drwxr-xr-x    8 git      git            150 Mar 20 13:22 .
drwxr-xr-x   14 git      git           4096 Mar  6 23:04 ..
-rw-r--r--    1 git      git             21 May  9  2023 HEAD
drwxr-xr-x    2 git      git              6 May  9  2023 branches
-rw-r--r--    1 git      git             66 Mar 20 13:22 config
-rw-r--r--    1 git      git             73 May  9  2023 description
drwxr-xr-x    6 git      git           4096 Mar 17 02:07 hooks
drwxr-xr-x    2 git      git             33 Mar 20 13:24 info
drwxr-xr-x    3 git      git             30 Mar 19 11:26 logs
drwxr-xr-x  260 git      git           8192 Mar 20 13:24 objects
-rw-r--r--    1 git      git         164524 Mar 20 13:22 packed-refs
drwxr-xr-x    5 git      git             43 Jul 17  2023 refs

Anything I can do to resolve this?

Below are the logs

2024/03/20 12:56:57 ...repository/branch.go:141:loadOneBranch() [E] CountDivergingCommits: exit status 128 - fatal: ambiguous argument 'main...refs/heads/tto-device-discovery': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
 - fatal: ambiguous argument 'main...refs/heads/tto-device-discovery': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
2024/03/20 12:56:57 ...eb/routing/logger.go:78:func1() [W] router: failed    GET /sot/netbox-sot/branches for [<redacted>]:0, panic in 65.6ms @ repo/branch.go:37(repo.Branches), err=runtime error: invalid memory address or nil pointer dereference
2024/03/20 12:56:57 ...rs/common/errpage.go:26:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:914 (0x43eefe)
/go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:116 (0x1ab40e8)
/usr/local/go/src/runtime/panic.go:914 (0x43eefe)
/usr/local/go/src/runtime/panic.go:261 (0x4566b7)
/usr/local/go/src/runtime/signal_unix.go:861 (0x456685)
/go/src/code.gitea.io/gitea/services/repository/branch.go:187 (0x1e3c44e)
/go/src/code.gitea.io/gitea/services/repository/branch.go:103 (0x1e3b88e)
/go/src/code.gitea.io/gitea/routers/web/repo/branch.go:56 (0x251de6f)
/usr/local/go/src/reflect/value.go:596 (0x4f23a6)
/usr/local/go/src/reflect/value.go:380 (0x4f1478)
/go/src/code.gitea.io/gitea/modules/web/handler.go:166 (0x1abd75b)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/chain.go:31 (0x1ab4745)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/middleware/get_head.go:37 (0x24e917b)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/context/context.go:223 (0x1bd1d0e)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20230613035928-39541325faa3/session.go:257 (0x1b2a755)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73 (0x1ab5335)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316 (0x1ab6c1a)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73 (0x1ab5335)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316 (0x1ab6c1a)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:122 (0x1ab3f78)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x2433fd3)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:46 (0x24351f2)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:37 (0x2434d75)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:100 (0x2434335)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03)
/usr/local/go/src/net/http/server.go:2136 (0x9a42a8)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:90 (0x1ab52f4)
/go/src/code.gitea.io/gitea/modules/web/route.go:163 (0x1abee27)
/usr/local/go/src/net/http/server.go:2938 (0x9a6f8d)
/usr/local/go/src/net/http/server.go:2009 (0x9a2e73)
/usr/local/go/src/runtime/asm_amd64.s:1650 (0x475b00)

Screenshots

2024-03-20_09-12
2024-03-20_09-16
2024-03-20_09-20

Gitea Version

1.21.8

Can you reproduce the bug on the Gitea demo site?

No

Operating System

Rocky Linux 9 (gitea inside docker)

Browser Version

Google Chrome Version 120.0.6099.224 (Official Build) (64-bit)

Originally created by @davama on GitHub (Mar 20, 2024). ### Description Good Day, Hope I've posted all relevant info. We have a repo inside an org, which does not allow us to view its branches via the UI. We had several branches that were automatically created with our pipeline via the API. We've been doing this for several months now. Only yesterday we noticed that we could not see the branches in the UI (this was never the case before). We were under version `1.21.7` and were hoping updating to `1.21.8` would help, but nothing. Since we could see all the branches via the API, we decided to delete all the branches via API except for `main`. Now only `main` shows via the API. Interestingly under the UI, it still shows that `2 Branches` exists. (see screenshots) When i click on the `tto-device-discovery` branch, i get a `404` not found code page, which should be correct (see screenshot) Looking at other tickets, i check permissions on the filesystem, but nothing interesting ``` git-1:/data/git/repositories/sot/netbox-sot.git$ pwd /data/git/repositories/sot/netbox-sot.git git-1:/data/git/repositories/sot/netbox-sot.git$ ls -al total 196 drwxr-xr-x 8 git git 150 Mar 20 13:22 . drwxr-xr-x 14 git git 4096 Mar 6 23:04 .. -rw-r--r-- 1 git git 21 May 9 2023 HEAD drwxr-xr-x 2 git git 6 May 9 2023 branches -rw-r--r-- 1 git git 66 Mar 20 13:22 config -rw-r--r-- 1 git git 73 May 9 2023 description drwxr-xr-x 6 git git 4096 Mar 17 02:07 hooks drwxr-xr-x 2 git git 33 Mar 20 13:24 info drwxr-xr-x 3 git git 30 Mar 19 11:26 logs drwxr-xr-x 260 git git 8192 Mar 20 13:24 objects -rw-r--r-- 1 git git 164524 Mar 20 13:22 packed-refs drwxr-xr-x 5 git git 43 Jul 17 2023 refs ``` Anything I can do to resolve this? Below are the logs ``` 2024/03/20 12:56:57 ...repository/branch.go:141:loadOneBranch() [E] CountDivergingCommits: exit status 128 - fatal: ambiguous argument 'main...refs/heads/tto-device-discovery': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' - fatal: ambiguous argument 'main...refs/heads/tto-device-discovery': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' 2024/03/20 12:56:57 ...eb/routing/logger.go:78:func1() [W] router: failed GET /sot/netbox-sot/branches for [<redacted>]:0, panic in 65.6ms @ repo/branch.go:37(repo.Branches), err=runtime error: invalid memory address or nil pointer dereference 2024/03/20 12:56:57 ...rs/common/errpage.go:26:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference /usr/local/go/src/runtime/panic.go:914 (0x43eefe) /go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:116 (0x1ab40e8) /usr/local/go/src/runtime/panic.go:914 (0x43eefe) /usr/local/go/src/runtime/panic.go:261 (0x4566b7) /usr/local/go/src/runtime/signal_unix.go:861 (0x456685) /go/src/code.gitea.io/gitea/services/repository/branch.go:187 (0x1e3c44e) /go/src/code.gitea.io/gitea/services/repository/branch.go:103 (0x1e3b88e) /go/src/code.gitea.io/gitea/routers/web/repo/branch.go:56 (0x251de6f) /usr/local/go/src/reflect/value.go:596 (0x4f23a6) /usr/local/go/src/reflect/value.go:380 (0x4f1478) /go/src/code.gitea.io/gitea/modules/web/handler.go:166 (0x1abd75b) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/chain.go:31 (0x1ab4745) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/middleware/get_head.go:37 (0x24e917b) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:176 (0x1abd7f7) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/context/context.go:223 (0x1bd1d0e) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20230613035928-39541325faa3/session.go:257 (0x1b2a755) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73 (0x1ab5335) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316 (0x1ab6c1a) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73 (0x1ab5335) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316 (0x1ab6c1a) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444 (0x1ab7693) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/routing/logger_manager.go:122 (0x1ab3f78) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x2433fd3) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/routers/common/middleware.go:46 (0x24351f2) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/routers/common/middleware.go:37 (0x2434d75) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/routers/common/middleware.go:100 (0x2434335) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/src/code.gitea.io/gitea/modules/web/handler.go:145 (0x1abda03) /usr/local/go/src/net/http/server.go:2136 (0x9a42a8) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:90 (0x1ab52f4) /go/src/code.gitea.io/gitea/modules/web/route.go:163 (0x1abee27) /usr/local/go/src/net/http/server.go:2938 (0x9a6f8d) /usr/local/go/src/net/http/server.go:2009 (0x9a2e73) /usr/local/go/src/runtime/asm_amd64.s:1650 (0x475b00) ``` ### Screenshots ![2024-03-20_09-12](https://github.com/go-gitea/gitea/assets/5359152/c271f768-8941-42fb-9cbd-92290b796fd9) ![2024-03-20_09-16](https://github.com/go-gitea/gitea/assets/5359152/5d6afdb1-0c2a-4818-85c6-a6d1eda59902) ![2024-03-20_09-20](https://github.com/go-gitea/gitea/assets/5359152/ef4e9afa-53b1-41c4-b360-5e1ae702a351) ### Gitea Version 1.21.8 ### Can you reproduce the bug on the Gitea demo site? No ### Operating System Rocky Linux 9 (gitea inside docker) ### Browser Version Google Chrome Version 120.0.6099.224 (Official Build) (64-bit)
GiteaMirror added the topic/uitype/bug labels 2025-11-02 10:18:08 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Mar 20, 2024):

Maybe it could be "fixed" by "Fix loadOneBranch panic #29938"

@wxiaoguang commented on GitHub (Mar 20, 2024): Maybe it could be "fixed" by "Fix loadOneBranch panic #29938"
Author
Owner

@wxiaoguang commented on GitHub (Mar 20, 2024):

Oh one more thing, maybe you could try to click "Sync branches" on the site admin panel, to re-sync all branches.

@wxiaoguang commented on GitHub (Mar 20, 2024): Oh one more thing, maybe you could try to click "Sync branches" on the site admin panel, to re-sync all branches.
Author
Owner

@davama commented on GitHub (Mar 20, 2024):

Oh one more thing, maybe you could try to click "Sync branches" on the site admin panel, to re-sync all branches.

@wxiaoguang
thank you for the quick reply and PR!!

I clicked on Sync missed branches from git data to databases not sure if the same...

But now I dont get the Error 500!! Woohoo!

@davama commented on GitHub (Mar 20, 2024): > Oh one more thing, maybe you could try to click "Sync branches" on the site admin panel, to re-sync all branches. @wxiaoguang thank you for the quick reply and PR!! I clicked on `Sync missed branches from git data to databases ` not sure if the same... But now I dont get the Error 500!! Woohoo!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12686