Thanks Dan,
It’s strange though that running it with the caps lock on would prevent this error. Turning the caps lock off after it runs gives me no errors.
I may have fixed it however, though I don’t understand why. As I said before the script makes a new composition and then adds it into the main composition. It then copies layers into this newly created composition and adds expression. The thing I changed is that I now have the script collapsing this new composition. For some reason I’m not getting the error anymore. I’m cautiously optimistic.
I should say that I’m working on cs6 which I have found to be buggy.
-Julian