Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard 500 Error - error calling GetRepoLink: runtime error: invalid memory address or nil pointer dereference #32496

Closed
CeddaerrixGE opened this issue Nov 13, 2024 · 4 comments · Fixed by #32501
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/bug
Milestone

Comments

@CeddaerrixGE
Copy link

CeddaerrixGE commented Nov 13, 2024

Description

On a RKE2 cluster, I have Gitea installed using the Helm chart (as a dependency of an umbrella chart).
After an RKE2 upgrade, an Ingress related issue occurred so as a workaround I executed helm uninstall <RELEASE_NAME> -n <MY_NAMESPACE> and then helm upgrade <RELEASE_NAME> <MY_CHART> -n <MY_NAMESPACE> --install, which resolved the Ingress issue.
Nonetheless, when verifying the Gitea UI (login with admin user), the default page is rendering:
image
The 2 menu drop-down's are not working unless I change page first (i.e. as long as I am not on the default page):
image

The Gitea container logs show:

2024/11/13 14:48:58 ...er/issues/indexer.go:76:func1() [I] PID 7: Initializing Issue Indexer: db
2024/11/13 14:48:58 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 31.474µs
2024/11/13 14:48:58 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2024/11/13 14:48:58 modules/ssh/ssh.go:331:Listen() [I] Adding SSH host key: /data/ssh/gitea.rsa
2024/11/13 14:48:58 ...xer/stats/indexer.go:87:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2024/11/13 14:48:58 modules/ssh/init.go:26:Init() [I] SSH server started on :2222. Cipher list ([chacha20-poly1305@openssh.com aes128-ctr aes192-ctr aes256-ctr aes128-gcm@openssh.com aes256-gcm@openssh.com]), key exchange algorithms ([curve25519-sha256 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha256 diffie-hellman-group14-sha1]), MACs ([hmac-sha2-256-etm@openssh.com hmac-sha2-256 hmac-sha1])
2024/11/13 14:48:58 ...s/graceful/server.go:50:NewServer() [I] Starting new SSH server: tcp::2222 on PID: 7
2024/11/13 14:48:59 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/11/13 14:48:59 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): https://gitea.amp.myco.com/
2024/11/13 14:48:59 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 7
2024/11/13 14:49:18 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 10.42.0.51:39990, 200 OK in 2.7ms @ web/home.go:32(web.Home)
2024/11/13 14:49:23 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 10.42.0.51:39990, 200 OK in 1.3ms @ web/home.go:32(web.Home)
2024/11/13 14:49:24 ...eb/routing/logger.go:102:func1() [I] router: completed GET /explore/repos for 10.42.0.51:39990, 200 OK in 24.8ms @ explore/repo.go:196(explore.Repos)
2024/11/13 14:49:31 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 10.42.0.51:39990, 200 OK in 7.4ms @ web/home.go:32(web.Home)
2024/11/13 14:49:33 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login?redirect_to=%2f for 10.42.0.51:39990, 200 OK in 3.6ms @ auth/auth.go:164(auth.SignIn)
2024/11/13 14:49:40 ...eb/routing/logger.go:102:func1() [I] router: completed POST /user/login for 10.42.0.51:39990, 303 See Other in 62.3ms @ auth/auth.go:196(auth.SignInPost)
2024/11/13 14:49:40 ...activities/action.go:207:loadRepo() [E] repo_model.GetRepositoryByID(2): repository does not exist [id: 2, uid: 0, owner_name: , name: ]
2024/11/13 14:49:40 .../context_response.go:88:HTML() [E] Render failed: failed to render template: user/dashboard/dashboard, error: template error: builtin(bindata):user/dashboard/feeds:20:45 : executing "user/dashboard/feeds" at <.GetRepoLink>: error calling GetRepoLink: runtime error: invalid memory address or nil pointer dereference
----------------------------------------------------------------------
							{{ctx.Locale.Tr "action.commit_repo" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}}
							                                      ^
----------------------------------------------------------------------
2024/11/13 14:49:40 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 10.42.0.51:39990, 200 OK in 25.7ms @ web/home.go:32(web.Home)

I have found the issue #24856 that refers to the same runtime error, but it did not provide any insight on what could be the cause.

Gitea Version

1.22.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

RHEL 8.10

How are you running Gitea?

On a RKE2 cluster

Database

PostgreSQL

@CeddaerrixGE
Copy link
Author

Additionally, registering a new user and signing in with it afterward does not result in such error:
image

@lunny
Copy link
Member

lunny commented Nov 13, 2024

This is because some repository has been deleted but the actions related to that repository have not been deleted. This could be fixed by running ./gitea doctor check --run check-db-consistency

@lunny lunny added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Nov 13, 2024
@wxiaoguang
Copy link
Contributor

-> Fix nil panic if repo doesn't exist #32501

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 14, 2024

A quick workaround could be truncate the action table (it only contains the user actions for display purpose only, it's safe to delete any data from it, or backup it before truncating if you'd like to keep the data)

@lunny lunny closed this as completed in 985e2a8 Nov 14, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Nov 14, 2024
wxiaoguang added a commit that referenced this issue Nov 14, 2024
Backport #32501 by wxiaoguang

fix  #32496

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@lunny lunny added this to the 1.22.4 milestone Nov 15, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants