Troubleshooting in a modern Software-As-A-Service (SaaS) like SharePoint Online is not my interest. Last week I had a customer who asked to look into an out-of-the-box Search problem in SharePoint Online. When searching on the search box, SharePoint Online throws out the message below:
“Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
Template ‘~sitecollection/_catalogs/masterpage/Display Templates/Search/Control_SearchBox.js’ not found or has syntax errors. (LoadTemplate: )”
After a few times trying to activate and deactivate with the hope that the Display Template would be automatically provisioned, but no luck.
I came to the decision to copy the Display Templates folder in a newly created site collection to the missing one. Firstly, I connected to my site collection using SharePoint Designer. I then created a new folder in the path (site collection > All Files > _catalogs >masterpage) named Display Templates. During the copy, SharePoint Designer responded to me there was a conflict because Display Templates still existed in the masterpage folder. I checked every language pack folder and finally found it. The last step was to move it to the masterpage folder and try to search again.
Perhaps someone accidentally dragged Display Templates folder into a language pack folder when working with SharePoint Designer that SharePoint Online was not able to locate correctly. This is a real-world experience of troubleshooting. This post would be helpful at least if you are in the urgent situation troubleshooting SharePoint Online.