Upgrading pip resolved this issue for. Sharing if others encounter the same:
python.exe -m pip install --upgrade pip
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
We are getting "Server[pid=XXXX] is already being debugged" when trying to debug an azure function locally in Visual Studio Code. No change to the debug configuration; we noticed the problem 02/12/25 after a few days not using it.
We use the launch.json and the tasks.json generated automatically by VSC:
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 9091
},
"preLaunchTask": "func: host start"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-python-watch",
"isBackground": true,
"dependsOn": "pip install (functions)"
},
{
"label": "pip install (functions)",
"type": "shell",
"osx": {
"command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
},
"windows": {
"command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
},
"linux": {
"command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
},
"problemMatcher": []
},
{
"type": "func",
"command": "extensions install",
"problemMatcher": [],
"label": "func: extensions install"
}
]
}
We have verified that port 9091 is not in use.
Interestingly, if we have several VSC windows open, the error message "Server[pid=XXXX] is already being debugged" pops up in every windows, not just the one where we are running the debugger.
VSC version 1.97 for macos.
Restarting VSC or even rebooting the computer does not solve the problem.
Any suggestion?
Thanks,
JD
Upgrading pip resolved this issue for. Sharing if others encounter the same:
python.exe -m pip install --upgrade pip
Hi, disable the firewall temporarily – sometimes it blocks the debugging port.
Run VS Code as an administrator – this can resolve permission-related issues.
Start Azure Functions with verbose logging using func start --verbose
This will give u more detailed logs to diagnose the problem.
If the issue persists, try reinstalling Azure Functions Core Tools:
npm uninstall -g azure-functions-core-tools
npm install -g azure-functions-core-tools@4 --unsafe-perm true
Debugging issues like this are often caused by stale processes, port conflicts, or outdated dependencies.
rgds,
alex