Improve Error Handling for Unique Constraint Violations in Assets Imports

XMLWordPrintable

    • 24
    • 8

      Summary

      When importing objects into Assets using the API or UI, customers often encounter Unique Constraint Violation errors. These errors currently provide no actionable information about which attribute or value caused the conflict, which makes troubleshooting extremely difficult — especially for large data sets.

      Problem Statement

      • Current Behavior:
        • The error message is a generic "Unique Constraint Violation" — with no details about:
          • Which attribute failed.
          • What the duplicate value is.
          • Whether the conflict is with an existing object or within the import file.
        • The missing details create time-consuming trial-and-error for admins.
      • Real-World Scenarios:
        • Scenario 1: The attribute used as the identifier in the import is also marked as Unique.
          → If duplicate values appear in the import or already exist in the schema, the import fails and recovery is complex.
        • Scenario 2: A non-identifier attribute is marked as Unique.
          → If there's a duplicate in the import file or existing objects, the import fails but simply removing the Uniqueconstraint from this attribute resolves the issue immediately — no identifier change needed.
      • Known Issue:
        • Due to a known bug, Assets imports no longer display detailed logs about which objects fail when unique constraints are violated.

      Steps to Reproduce

      1. Define an Object Type with attributes:
        • Name → Label
        • Email → Unique + Identifier
        • Username → Unique (Non-Identifier)
      1. Import a JSON or CSV file with:
        • Duplicate email values → triggers Scenario 1
        • Duplicate username values → triggers Scenario 2
      1. The import fails with the same generic error:
        "Unique Constraint Violation"
      2. No details about which attribute/value failed are shown.

      Workarounds 

      Scenario 1: If the Identifier is Unique
      Temporary fix:

      • Temporarily change the identifier in the import config to another unique attribute.
      • Remove the Unique flag from the original attribute.
      • Run a small test import.
      • Once successful, revert the identifier back

      Scenario 2: If a Non-Identifier is Unique
      Simple fix:

      • Remove the Unique constraint from the non-identifier attribute.
      • Run the import.

      Expected Improvement

      When an import fails, display clear error details:

      • Which attribute caused the conflict.
      • The duplicate value.
      • If the conflict is with an existing object or within the import file.

            Assignee:
            Unassigned
            Reporter:
            Riyas Hameed
            Votes:
            24 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: