It seems that when you upgrade to 2.4.3 Magento discovers duplicates in
catalog_url_rewrite_product_category
table. I haven't figured out from where they came as in the 2.4.2 version all worked fine. No errors anywhere. I am suspecting that these came from migration. My store was migrated from version 1.
To solve this issue I created a new temporary table in the database running this query:
CREATE TABLE copy_of_table SELECT DISTINCT url_rewrite_id, category_id, product_id FROM catalog_url_rewrite_product_category;
With this, the new table created has removed all the duplicates.
So then I added the same relations from
catalog_url_rewrite_product_category
and deleted
table catalog_url_rewrite_product_category
and renamed the temporary table with this setup:upgrade
Don't do this in production instances and always take backup of the database before.