Without seeing your code, it’s hard to guess the issues. Using @tables.in_transaction might help resolve the conflict
more info here