Skip to content

Failing to save drafts - Integrity constraint violationΒ #176

@paulnzime

Description

@paulnzime

Description

When trying to create a draft we get the following error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '15513924731215' for key 'shopify_products.idx_xegbjaxkssvjjizdwoijbjodambngmoprvio'\nThe SQL being executed was: INSERT INTO `shopify_products` (`id`, `shopifyId`, `shopifyGid`, `dateUpdated`, `dateCreated`, `uid`) VALUES (1163, '15513924731215', 'gid://shopify/Product/15513924731215', '2025-07-31 10:57:46', '2025-07-31 10:57:46', 'f5b6b4d9-0665-47a2-bc8a-fae9a62546fc')

This also occurs when Crafts tries to auto-create the draft on editing a field.
Because of this, if we then assign a matrix field to the product we cannot add any blocks as the same error gets triggered.

Any assistance here would be greatly appreciated.

We do have 3 sites configured with unique content between them but other than that its a relatively fresh Craft 5 install.

Steps to reproduce

  1. Sync a couple of products from Shopify
  2. Edit a product and click Create Draft
  3. Note the error

If the error does not occur, try adding multiple sites.

Additional info

  • Craft version: 5.8.11
  • PHP version: 8.3
  • Database driver & version: MySQL 8.0.40
  • Plugins & versions: Shopify 6.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions