Fix exception type when record is duplicated
(cherry picked from commit a92addf)
Merge remote-tracking branch 'nuvolabase/hotfix-1.6.1' into hotfix-1.6.1