Render failed when opening PR with conversation #12670

Closed
opened 2025-11-02 10:17:44 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @fhennig42 on GitHub (Mar 18, 2024).

Description

I upgraded my gitea instance to version 1.21.7.
When I open certain PR's which already have a conversation/comments attached, I get the following error:

Render failed, failed to render template: repo/pulls/files, error: template error: builtin(bindata):repo/diff/conversation:4:45 : executing "repo/diff/conversation" at <0>: nil pointer evaluating *issues.Review.Type

{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}}

^

Since this looked similar to https://github.com/go-gitea/gitea/issues/29773 I also tried the newer versions 1.21.9 and even nightly with the same results.

Gitea Version

1.21.7

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/fhennig42/7247399e2e87f6d7050414633661ff46

Screenshots

image

Git Version

2.40.1

Operating System

Ubuntu 22.04

How are you running Gitea?

docker (official docker image managed by doker-compose)

Database

None

Originally created by @fhennig42 on GitHub (Mar 18, 2024). ### Description I upgraded my gitea instance to version 1.21.7. When I open certain PR's which already have a conversation/comments attached, I get the following error: ``` Render failed, failed to render template: repo/pulls/files, error: template error: builtin(bindata):repo/diff/conversation:4:45 : executing "repo/diff/conversation" at <0>: nil pointer evaluating *issues.Review.Type {{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}} ^ ``` Since this looked similar to https://github.com/go-gitea/gitea/issues/29773 I also tried the newer versions 1.21.9 and even nightly with the same results. ### Gitea Version 1.21.7 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://gist.github.com/fhennig42/7247399e2e87f6d7050414633661ff46 ### Screenshots ![image](https://github.com/go-gitea/gitea/assets/79085691/0f8aac4c-e3d2-4788-8bd4-0d5a980a49e9) ### Git Version 2.40.1 ### Operating System Ubuntu 22.04 ### How are you running Gitea? docker (official docker image managed by doker-compose) ### Database None
GiteaMirror added the type/bug label 2025-11-02 10:17:44 -06:00
Author
Owner

@silverwind commented on GitHub (Mar 18, 2024):

Hmm, not sure whether this is regression or not. Line is here:

440be51a45/templates/repo/diff/conversation.tmpl

@silverwind commented on GitHub (Mar 18, 2024): Hmm, not sure whether this is regression or not. Line is here: https://github.com/go-gitea/gitea/blob/440be51a451baf08098501e300181cd77d798e11/templates/repo/diff/conversation.tmpl
Author
Owner

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

It is not related to 29773, I think the root cause is that some database records are deleted then the template fails to render.

My guess is that the "review" is deleted.

I could remember a recent PR: Workaround to clean up old reviews on creating a new one (#28554) #29264

@6543 do you have more ideas?

@wxiaoguang commented on GitHub (Mar 18, 2024): It is not related to 29773, I think the root cause is that some database records are deleted then the template fails to render. My guess is that the "review" is deleted. I could remember a recent PR: Workaround to clean up old reviews on creating a new one (#28554) #29264 @6543 do you have more ideas?
Author
Owner

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

A quick and dirty fix could be like this: Fix template error when comment review doesn't exist #29888

@wxiaoguang commented on GitHub (Mar 18, 2024): A quick and dirty fix could be like this: Fix template error when comment review doesn't exist #29888
Author
Owner

@fhennig42 commented on GitHub (Mar 18, 2024):

Wow, that was quite fast. I just built the docker image with the fix on your branch before it was merged. As far as I can tell it worked like a charm. I'm able to see the conversation and inline comments in the PR files view.
I will test this again when the official 1.12.9 is out and then close the issue.

Thanks a lot for looking into this so fast 🚀

@fhennig42 commented on GitHub (Mar 18, 2024): Wow, that was quite fast. I just built the docker image with the fix on your branch before it was merged. As far as I can tell it worked like a charm. I'm able to see the conversation and inline comments in the PR files view. I will test this again when the official 1.12.9 is out and then close the issue. Thanks a lot for looking into this so fast :rocket:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12670