A long time ago and far, far away, I had a script that wouldn’t run, much like yours. Copy and paste into a new document didn’t help. I decided the script file was corrupted and retyped the code by hand, which was a lot of lines. That fixed the problem.
If doing it today, I’d copy about half the script into a new window, compile and save it, then check for the problem. If it failed, I’d do the other half instead, if it checked out as okay. Then I’d keep adding about half of the remaining code (rechecking each time) until I isolated the corrupted section. That portion, I’d hand type, and then paste in any left over code.
There’s no way to know it your problem is the same as mine was, but it might be worth a try.