VSC Azure function Server[pid=XXXX] is already being debugged

Jean David Ruvini 90 Reputation points
2025-02-13T19:41:04.6666667+00:00

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

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,414 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.