I didn't do a whole lot of version testing, but I used to always used to just use Python as my run configuration, even for Flask apps. It seems lately (maybe Python 3.11?), the app crashed with a very similar error when debugging a flask app with that setting. I set the run/debug configuration template as FLASK SERVER, and it worked.