The exact error message is only "createTOC"
I haven't tried yet with InDesign CC Desktop.
Here is the call to createTOC():
"
var nonprintingLayer = thisDocument.layers.add({printable:false});
tocStory = thisDocument.createTOC(tocStyle,false,null,[0,0],true,nonprintingLayer);
"
To show the rest of the function wouldn't be very useful without sending the entire script.
The variable "tocStyle" is valid. I exported the document via the script to IDML and opened it in CS6 Desktop. The tocStyle was fine, and I was able to generate the TOC manually.