From 5992dcdfdaf01c1144f968c357218a2d2f4191a5 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 22 May 2023 12:12:02 +1000 Subject: [PATCH] Handle ValidationError when creating a new setting (#4868) - Duplicate keys can occur in some race conditions - Catch and pass ValidationError --- InvenTree/common/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 7a26b0c11d..45dcf50113 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -453,6 +453,9 @@ class BaseInvenTreeSetting(models.Model): except (IntegrityError, OperationalError): # It might be the case that the database isn't created yet pass + except ValidationError: + # The setting failed validation - might be due to duplicate keys + pass if setting and do_cache: # Cache this setting object