magento, error when reindexing Catalog URL Rewrites

magento, error when reindexing Catalog URL Rewrites

August 20, 2026 · Illustrated author avatarBy Stefan Bogdanescu
magento, error when reindexing Catalog URL Rewrites

Resolving Magento Error: Duplicate Entry Issue During Reindexing Catalog URL Rewrites

Last Updated: [Date] | By: Your Name

Dear developer community,

I hope this post finds you well. Today, we’re going to tackle a common issue that arises after upgrading from Magento 1.4.1—an error occurring during the reindexing of catalog URL rewrites.

Understanding the Error Message

The error message you’ve received is quite specific:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/19-1-2' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'

Let’s break this down:

  • SQLSTATE [23000]: This indicates a database integrity constraint violation, meaning the data you’re trying to insert already exists.
  • 1062 Duplicate entry ‘product/19-1-2’: The unique key constraint for the core_url_rewrite table has been violated by an attempt to insert a duplicate value of 'product/19-1-2'.
  • UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID: This is the name of the unique key that’s being violated.

The issue lies in the combination of path (‘product/19-1-2’) and other columns (id, is_system, store_id) within the core_url_rewrite table. You’re seeing a duplicate entry, but you can’t find it through the Magento backend or directly in the database.

Finding the Culprit Entry

Step 1: Identify the Product ID

The first part of the path, ‘product’, indicates that this is an URL rewrite for a product. The second part, ‘19-1-2’, suggests that it’s a child category path.

To find the specific product or category causing the issue:

  1. Open your MySQL client and connect to your Magento database.
  2. Use the following query to identify the product ID associated with the path:
SELECT entity_id FROM catalog_category_entity AS cce
JOIN core_url_rewrite AS curw ON curw.path = CONCAT('category/', cce.entity_id);

If no category is found, replace catalog_category_entity with catalog_product_entity.

Step 2: Check for Existing URL Rewrites

Now that you have the product or category ID, check if there are any existing URL rewrites associated with it:

SELECT * FROM core_url_rewrite WHERE path LIKE 'product/%' OR path LIKE 'category/%';

Look for any entries with a path value matching your issue (‘product/19-1-2’ or similar).

Step 3: Verify the Store Id

The third component of the unique key is the store_id. Ensure that there are no duplicate URL rewrites across different stores.

Resolving the Issue

Once you’ve identified the problematic entry, you have a few options:

  1. Delete the duplicate entry: Use the following query to delete the specific row causing the error:

    DELETE FROM core_url_rewrite WHERE id = [problematic_id];
    
  2. Update the URL key: If possible, update the url_key of the product or category to create a unique path.

  3. Reindex the catalog URL rewrites: After resolving the issue, run the following command in SSH:

    php -f <path_to_magento>/shell/indexer.php --reindex catalog_url
    

Conclusion

In conclusion, Magento’s core_url_rewrite table can sometimes develop duplicate entries during upgrades or when working with multiple stores. To resolve this issue:

  1. Identify the problematic product or category using SQL queries.
  2. Delete the duplicate entry directly from the database (be cautious).
  3. Update URL keys to maintain uniqueness.
  4. Reindex the catalog URL rewrites.

Remember, always backup your database before performing any direct SQL operations. If you’re unsure about any step, don’t hesitate to reach out to our Magento experts at Laravel Company.

Stay safe and happy coding!

Magento 1 Catalog Indexing Database

Our network