Thanks for your feedback.
There are a few ways that you can tackle this, but I would suggest downloading the source and stepping through the following code:
This is where the code uses SMO to script objects to disk.
If you right-click on the Source Database, and select Properties, you will be able to flag which objects to script to disk. I would suggest turning everything off at first, and then try to script only the table that causes an error.
I am very interested in what you may find - if there is a bug in the code, then let me know and I will fix it.