API repo pulls error: invalid memory address or nil pointer dereference #14583

Closed
opened 2025-11-02 11:16:48 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @witten on GitHub (Jun 10, 2025).

Originally assigned to: @lunny on GitHub.

Description

When accessing an API repo pulls URL, I get a HTTP 500 response. The API URL I'm using is: https://projects.torsion.org/api/v1/repos/borgmatic-collective/borgmatic/pulls?state=closed

Here is the corresponding Gitea log from that request:

2025/06/10 19:25:15 HTTPRequest [W] router: failed    GET /api/v1/repos/borgmatic-collective/borgmatic/pulls?state=closed for 10.89.0.32:59014, panic in 105.3ms @ repo/pull.go:46(repo.ListPullRequests), err=runtime error: invalid memory address or nil pointer dereference
/go/src/code.gitea.io/gitea/routers/api/v1/repo/pull.go:147 (0x290c765)
/go/src/code.gitea.io/gitea/routers/api/v1/api.go:1757 (0x2965af6)

Here is the web interface for the corresponding project's pull requests: https://projects.torsion.org/borgmatic-collective/borgmatic/pulls

Gitea Version

1.24.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

relevant logs included inline above

Screenshots

No response

Git Version

2.49.0

Operating System

Linux Manjaro stable

How are you running Gitea?

I'm running Gitea via Podman (and Docker Compose) in a container, using the official image from docker.io/gitea/gitea. Requests to Gitea are reverse proxied through Traefik.

Database

PostgreSQL

Originally created by @witten on GitHub (Jun 10, 2025). Originally assigned to: @lunny on GitHub. ### Description When accessing an API repo pulls URL, I get a HTTP 500 response. The API URL I'm using is: https://projects.torsion.org/api/v1/repos/borgmatic-collective/borgmatic/pulls?state=closed Here is the corresponding Gitea log from that request: ``` 2025/06/10 19:25:15 HTTPRequest [W] router: failed GET /api/v1/repos/borgmatic-collective/borgmatic/pulls?state=closed for 10.89.0.32:59014, panic in 105.3ms @ repo/pull.go:46(repo.ListPullRequests), err=runtime error: invalid memory address or nil pointer dereference /go/src/code.gitea.io/gitea/routers/api/v1/repo/pull.go:147 (0x290c765) /go/src/code.gitea.io/gitea/routers/api/v1/api.go:1757 (0x2965af6) ``` Here is the web interface for the corresponding project's pull requests: https://projects.torsion.org/borgmatic-collective/borgmatic/pulls ### Gitea Version 1.24.0 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist relevant logs included inline above ### Screenshots _No response_ ### Git Version 2.49.0 ### Operating System Linux Manjaro stable ### How are you running Gitea? I'm running Gitea via Podman (and Docker Compose) in a container, using the official image from `docker.io/gitea/gitea`. Requests to Gitea are reverse proxied through Traefik. ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 11:16:48 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Jun 10, 2025):

The log seems incomplete, the stacktrace should have more lines. Could you share the full stacktrace? It will be very helpful.

And it seems to be a regression of "Use batch database operations instead of one by one to optimze api pulls (#32680)" or some legacy bugs @lunny

@wxiaoguang commented on GitHub (Jun 10, 2025): The log seems incomplete, the stacktrace should have more lines. Could you share the full stacktrace? It will be very helpful. And it seems to be a regression of "Use batch database operations instead of one by one to optimze api pulls (#32680)" or some legacy bugs @lunny
Author
Owner

@lunny commented on GitHub (Jun 10, 2025):

I wasn’t able to reproduce the issue on my end. The line at /go/src/code.gitea.io/gitea/routers/api/v1/repo/pull.go:147 (0x290c765) appears to be normal. I tried to migrate the whole repository under https://projects.torsion.org/borgmatic-collective/borgmatic but it seems I cannot register an account.

@lunny commented on GitHub (Jun 10, 2025): I wasn’t able to reproduce the issue on my end. The line at `/go/src/code.gitea.io/gitea/routers/api/v1/repo/pull.go:147 (0x290c765)` appears to be normal. I tried to migrate the whole repository under https://projects.torsion.org/borgmatic-collective/borgmatic but it seems I cannot register an account.
Author
Owner

@witten commented on GitHub (Jun 10, 2025):

Thanks for the quick response! I've enabled debug logging, and here is the full stacktrace: af62a78651/error

@witten commented on GitHub (Jun 10, 2025): Thanks for the quick response! I've enabled debug logging, and here is the full stacktrace: https://gist.githubusercontent.com/witten/305e1852b66a80f0b86e90eeb93f6845/raw/af62a786513fba4642d21d1c52fe26916c72ace5/error
Author
Owner

@witten commented on GitHub (Jun 10, 2025):

If you'd like to try registering an account to repro this, please start here (click "register"): https://torsion.org/borgmatic/#contributing

@witten commented on GitHub (Jun 10, 2025): If you'd like to try registering an account to repro this, please start here (click "register"): https://torsion.org/borgmatic/#contributing
Author
Owner

@witten commented on GitHub (Jun 11, 2025):

Awesome, thank you!

@witten commented on GitHub (Jun 11, 2025): Awesome, thank you!
Author
Owner

@lunny commented on GitHub (Jun 11, 2025):

Awesome, thank you!

Thank you for the report.

@lunny commented on GitHub (Jun 11, 2025): > Awesome, thank you! Thank you for the report.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14583