I also had this damned problem.
It happens when inserting images in or out of a gallery
I investigated a little bit further and opened the Javascript Console (Safari)
to find this culprit :
https://www.elzede.net/elzede_com/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.4.4
Path = post.php > wp-polyfill.min.js > line 6446
Code source : var e = this;
Error messages
21 Unhandled Promise Rejection :{object Object}
21 Unhandled Promise Rejection : Syntax error: The string did not match the expected pattern
So btw I vaguely see where is located the trouble but I can’t go further (tracking the value of the string, etc. )
But I hope my modest investigation could help to get rid of this plague….
Thanks for your return