Hi Sam,
It is hard to say why some runs are failing without looking at the scripting code and at the exact errors reported.
As for duplicate gid values, I guess this can happen if two or more runs try to get the highest gid at the same time. Take a look at http://vroapi.com/Class/Intrinsics/1.0.0/LockingSystem scripting object; you can use its methods for locking/unlocking to guarantee that only a single run at a time will attempt to get the current gid. That is, each run has first to obtain a lock (shared with all other runs), then get the gid, then release the lock to unblock the other runs.