JavaScript error itemPermMasks.customFromJson is undefined in ribbon.js

I had a weird issue in my dev. env. where after I added a search results web part to a web part page I got a weird error in the browser console (itemPermMasks.customFromJson is undefined in sp.ribbon.js), and some functionality stopped working – to be precise:

  • Ribbon buttons stopped working
  • JavaScript code that relied on SP.SOD.* stopped working

Google didn’t really give me anything of value to resolve the issue, and I couldn’t understand how any of the JavaScript could cause the error either. 

The solution – or rather, the workaround, turned out to be quite simple: Change the search results web part from rendering results synchroneously to asynchroneusly. This makes SharePoint load the scripts the web part depends on differently, and luckily this was enough to solve the issue in my case.