Swift Playgrounds randomly refuses to run scripts on Mac
I'm running Swift Playgrounds on a MacBook Air M1 2020 running Ventura 13.6.6. At first it ran fine (using Get Started with Code), but then I kept getting a pop-up saying "There was a problem running this page" and it wouldn't execute the code, even when the code was perfectly valid and free of syntax errors.
Restarting Swift Playgrounds made it work again, but after running projects a couple of times, the same error cropped up again. Currently the code will run once and then the error occurs again.
I enabled verbose debugging and got this error message:
Google and ChatGPT have nothing. Swift Playgrounds are great but this error is really frustrating. How can I fix this?
MacBook Air (M1, 2020)