I found that you need to completely recreate the script project.
I had this problem in a script hosted in a spreadsheet. It only used the Mail and Spreadsheet services and happened randomly after zero changes for several months. I tried just to write the text, and it didn’t even work.
source share