API Program to create multiple projects - pre-translate failures

Hi,

I have created a program calling the Trados API that generates multiple Trados projects from the same template project.

The program creates the project, adds files recursively from a folder, scans the files, creates the translatable format, copies the translatable format files to the target language, pre-translates the files, analyses the files.

There are 82 Trados projects created in this way, one after the other, via a Jenkins job running an Ant script that calls my program 82 times. Across all 82 projects there are over 14K files.

Due to the number of files involved, I cleanup the AppData\Local\Temp folder for my user prior to each project creation.

I have noticed that a full run results in a number of projects failing to Pre-Translate properly. The status returned is "Failed".

QUESTION: I do not know how to dig out the precise reason for the failure so can anyone push me in the right direction?

The next time I run my script, concentrating only on those projects that did not pre-translate. Some that failed now pre-translate. No changes to the program, I simply re-ran it.

Subsequent runs reduce down the list of failed projects to zero after another 4 or 5 iterations.

This is obviously strange.

QUESTION: Can anyone suggest why I get this behavior as I'd like to be able to do a single job run to create them all? 

Best Regards

Mark