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

Jean David Ruvini 115 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,549 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jems Manjaly 15 Reputation points
    2025-02-23T10:39:22.3533333+00:00

    Upgrading pip resolved this issue for. Sharing if others encounter the same:

    python.exe -m pip install --upgrade pip

    3 people found this answer helpful.

  2. Alex Burlachenko 1,745 Reputation points
    2025-02-18T14:50:00.4666667+00:00

    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

    0 comments No comments

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.