# Internal Server Error (500) when updating a newly created product (e.g. its visibilitiy)

**URL:** <https://forum.shopware.com/t/internal-server-error-500-when-updating-a-newly-created-product-e-g-its-visibilitiy/99232>\
**Category:** Programming (EN)\
**Created:** [5. April 2023 um 12:30 UTC](https://forum.shopware.com/t/internal-server-error-500-when-updating-a-newly-created-product-e-g-its-visibilitiy/99232 "2023-04-05T12:30:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hauke.coltzau](https://avatars.discourse-cdn.com/v4/letter/h/8797f3/32.png) [@hauke.coltzau](https://forum.shopware.com/u/hauke.coltzau)\
**Post date:** [5. April 2023 um 12:30 UTC](https://forum.shopware.com/t/internal-server-error-500-when-updating-a-newly-created-product-e-g-its-visibilitiy/99232/1 "2023-04-05T12:30:55Z")

</div>

(System: Shopware 6.4.20.0)

Hi there,

we regularly synchronize product data from our PIM-systems to shops via the admin api. Creation a new product via POST request to the product entity endpoint works as expected.

But sometimes (not always), when we update a freshly created product, the shop returns an internal server error. For example, when we update the product visibility via API directly after creating the product, we get something like:

`Cannot add or update a child row: a foreign key constraint fails (`xxxxxxx\_shop\_sw6`.`product\_visibility`, CONSTRAINT `fk.product\_visibility.product\_id` FOREIGN KEY (`product\_id`, `product\_version\_id`) REFERENCES `product` (`id`, `version\_id`) ON DELETE)"}]}`

If we retry the synchronisation after a couple of minutes, the exact same call of updating the visibility, succeeds without any trouble.

I somehow have the feeling, that some caching or orm settings have the effect that the product is not directly written into the db and that the subsequent fails because of that.

Any idea, how to proceed?

Kind regards  
Hauke
