Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Summary: In Cursor on Windows, launching our Flask app through the built-in Run/Debug browser starts the server under debugpy. Even after closing Cursor, that debugpy process keeps port 5000 open. When I restarted Cursor, the port was still busy so the new Flask instance routed through the lingering debugpy proxy. That proxy wasn’t handling UTF-8 correctly, so any API response containing an emoji triggered ‘charmap’ codec can’t encode character … and the server stopped responding.
What I observed:
Using Cursor’s internal browser to start Flask (port 5000) leaves a background process running even after Cursor closes.
netstat -ano showed the same PID holding 127.0.0.1:5000 with CLOSE_WAIT connections; only killing that PID freed the port.
While the stale process was around, hitting the server via curl or the app produced the Unicode error and responses hung indefinitely.
Workaround: Manually terminate the old PID (Stop-Process -Id ), then start Flask from a regular terminal (python app.py). No more Unicode issues once the server runs outside the lingering debugpy instance.
Request: Please ensure Cursor’s internal browser/debug runner shuts down cleanly and releases sockets when the IDE closes, and/or provide a way to disable the auto-run behavior for web apps.
Steps to Reproduce
Steps to reproduce (Windows, Cursor 2025.14.x):
Open any Flask app inside Cursor.
Launch it via Cursor’s internal Run/Debug browser (the embedded web view) so the server starts on port 5000 under debugpy.
Close Cursor without stopping the server first.
Reopen Cursor and try to run the app again; the initial debugpy process still owns 127.0.0.1:5000.
Send a request that makes the Flask app return an emoji (e.g., a response containing
).
The response fails with UnicodeEncodeError: ‘charmap’ codec can’t encode character… and the request hangs until you terminate the stale PID.
Operating System
Windows 10/11
Current Cursor Version (Menu → About Cursor → Copy)
Version: 2.0.40 (user setup)
VSCode Version: 1.99.3
Commit: a9b73428ca6aeb2d24623da2841a271543735560
Date: 2025-10-30T04:12:35.564Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26200
Does this stop you from using Cursor
No - Cursor works, but with this issue