Error rendering code search page #12252

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

Originally created by @ShayArtzi on GitHub (Dec 22, 2023).

Description

Hello,

Not sure when did this start, but I'm getting the following error when using code search:

An error occurred:

Render failed, failed to render template: explore/code, error: template error: builtin(bindata):code/searchresults:34:83 : executing "code/searchresults" at <Safe>: wrong type for value; expected string; got template.HTML
----------------------------------------------------------------------
								<td class="lines-code chroma"><code class="code-inner">{{.FormattedLines | Safe}}</code></td>
								                                                                           ^
----------------------------------------------------------------------

image

Looks like the search does work but rendering the results fails:
image

I'm using bleve indexer with the following settings:

[indexer]
REPO_INDEXER_ENABLED = true
REPO_INDEXER_PATH = indexers/repos.bleve
MAX_FILE_SIZE = 1048576
REPO_INDEXER_INCLUDE =
REPO_INDEXER_EXCLUDE = resources/bin/**

The above config worked for me until I upgraded to one of the recent version (not sure which update, I haven't used code search for a bit).

I will appreciate any help - thanks very much!

Gitea Version

1.21.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

ubuntu

How are you running Gitea?

Running gitea binary as a systemd service on Ubuntu 22.04

Database

MySQL/MariaDB

Originally created by @ShayArtzi on GitHub (Dec 22, 2023). ### Description Hello, Not sure when did this start, but I'm getting the following error when using code search: ``` An error occurred: Render failed, failed to render template: explore/code, error: template error: builtin(bindata):code/searchresults:34:83 : executing "code/searchresults" at <Safe>: wrong type for value; expected string; got template.HTML ---------------------------------------------------------------------- <td class="lines-code chroma"><code class="code-inner">{{.FormattedLines | Safe}}</code></td> ^ ---------------------------------------------------------------------- ``` ![image](https://github.com/go-gitea/gitea/assets/7936008/0ad49c09-e2ac-4767-985c-9debc8271891) Looks like the search does work but rendering the results fails: ![image](https://github.com/go-gitea/gitea/assets/7936008/611f3357-9d38-4442-a461-e8abc06779ac) I'm using `bleve` indexer with the following settings: ``` [indexer] REPO_INDEXER_ENABLED = true REPO_INDEXER_PATH = indexers/repos.bleve MAX_FILE_SIZE = 1048576 REPO_INDEXER_INCLUDE = REPO_INDEXER_EXCLUDE = resources/bin/** ``` The above config worked for me until I upgraded to one of the recent version (not sure which update, I haven't used code search for a bit). I will appreciate any help - thanks very much! ### Gitea Version 1.21.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 ubuntu ### How are you running Gitea? Running gitea binary as a systemd service on Ubuntu 22.04 ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:03:27 -06:00
Author
Owner

@lunny commented on GitHub (Dec 22, 2023):

duplicated with #28575 ?

@lunny commented on GitHub (Dec 22, 2023): duplicated with #28575 ?
Author
Owner

@wxiaoguang commented on GitHub (Dec 22, 2023):

Please use 1.21 nightly build.

-> Fix 500 error of searching commits (#28576) #28579

@wxiaoguang commented on GitHub (Dec 22, 2023): Please use 1.21 nightly build. -> Fix 500 error of searching commits (#28576) #28579
Author
Owner

@ShayArtzi commented on GitHub (Dec 22, 2023):

Thanks all! I really appreciate it :)

@ShayArtzi commented on GitHub (Dec 22, 2023): Thanks all! I really appreciate it :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12252