I'd like to see the statements...but since this question is a year old...I won't old my breath.
I'm thinking the problem may be the GENERATED BY DEFAULT
And instead of passing NULL for the identity column, you're accidentally passing zero or some other duplicate value the first time around.
Either always pass NULL, pass a non-duplicate value or switch to GENERATED ALWAYS