Hi @Daniel Rodrigues
According to the error message, I find that in common this issue happens with "Search Server Web Parts and Templates" feature disable, you could check it and here are two similar cases for you to refer:
https://sharepoint.stackexchange.com/questions/70452/query-builder-for-result-source-not-working-in-central-admin
http://mahedevelopment.blogspot.com/2015/11/sharepoint-2013-display-templates.html
In 99 percent of the cases, this error is related to a bug in the code. That one percent will probably be related to someone that has deleted or moved the template.
You could also refer to this article for more to troubleshoot this issue:
https://www.eliostruyf.com/things-to-check-when-something-went-wrong-with-your-display-template/
Except for these cases, you could also go through everything in the SharePoint Design Manager: Edit Display Templates page and make sure that the Approval Status is "Approved" for everything on the page in question. Here is another similar issue with the same error message for you:https://sharepoint.stackexchange.com/questions/125131/display-error-the-display-template-had-an-error
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.