Repository navigation
Bug: Command 'python.getRecommendedEnvironment' already exists in multi-root workspace #25949
Copy link
Copy link
Closed
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Type: Bug
Behaviour
The Python extension fails to activate properly in multi-root workspaces, throwing a command registration error: command 'python.getRecommendedEnvironment' already exists. The error occurs during workspace activation but doesn't prevent core functionality from working.
Steps to reproduce:
- Create a minimal multi-root workspace structure:
mkdir -p /tmp/test-bug/{project-a,project-b}
cd /tmp/test-bug
python -m venv project-a/.venv
python -m venv project-b/.venv- Create a workspace file
test-bug.code-workspace:
{
"folders": [
{
"path": "project-a",
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
},
{
"path": "project-b",
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
}
]
}
-
Open the workspace in VS Code:
code /tmp/test-bug/test-bug.code-workspace -
Open the Output panel (View→Output) and select "Python" from the dropdown
-
Observe the command registration error in the logs when switching context betwen files of different workspaces
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2025-10-09 10:53:13.414 [info] > pyenv which python
2025-10-09 10:53:13.414 [info] cwd: /tmp/python-bug-repro/project-b
2025-10-09 10:53:13.422 [error] [
'Failed to activate a workspace, Class name = v, completed in 88ms, has a falsy return value, Arg 1: <Uri:/tmp/python-bug-repro/project-b/main.py>, Return Value: undefined',
[Error: command 'python.getRecommendedEnvironment' already exists
at Kb.registerCommand (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:40259)
at Object.registerCommand (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:199:102897)
at d.activate (/Users/antoine.meicler/.vscode/extensions/ms-python.python-2025.14.0-darwin-arm64/out/client/extension.js:2:530888)
at /Users/antoine.meicler/.vscode/extensions/ms-python.python-2025.14.0-darwin-arm64/out/client/extension.js:2:2457
at Array.map (<anonymous>)
at v.activateWorkspace (/Users/antoine.meicler/.vscode/extensions/ms-python.python-2025.14.0-darwin-arm64/out/client/extension.js:2:2447)]
]
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| python | ms- | 2025.14.0 |
| vscode-pylance | ms- | 2025.8.3 |
System Info
| Item | Value |
|---|---|
| CPUs | Apple M4 Pro (12 x 2400) |
| GPU Status | 2d_canvas: enabled direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: enabled_on trees_in_viz: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | 3, 4, 4 |
| Memory (System) | 48.00GB (0.83GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Activity
eleanorjboyd commentedon Oct 10, 2025
Hi! This is very strange, could you try uninstalling and reinstalling the python extension? Usually a command registration error can be fixed with a re-install when I have seen this in other cases
rdbisme commentedon Oct 10, 2025
Hello,
I have the same problem. Started occuring after the update to the yesterday release. Reverting to the previous one works. I'm on Windows, also in a multi-root workspace.
ameicler commentedon Oct 12, 2025
Hi Eleanor Boyd (@eleanorjboyd), thanks for your reply. Uninstalling and reinstalling the extension doesn't solve the issue unfortunately. I also tried to install previous versions, but facing same error. Do you manage to reproduce the issue on your end?
eleanorjboyd commentedon Dec 18, 2025
Hello! Gave this a try myself and not seeing this error. Can you send over your full logs?
github-actions commentedon Jan 1, 2026
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!
kohtala commentedon Jan 19, 2026
Hello, Eleanor Boyd (@eleanorjboyd), I am seeing this issue.
I cleaned up my workspace of extensions, uninstalled and installed Python, removed excess folders. While I still had two folders, the error still came. I had the folders run two different Python interpreters from two different .venv with different versions of Python (3.11 and 3.14).
After assigning both folder the same 3.14 venv, the error no longer happened.
When I again assigned different .venvs, the error started to appear. It is very persistent and appears every time I restart VSCode.
And, it seems it also happens when both have the same 3.11 .venv.
Output
I run VSCode on Windows and workspace is on a SSH remote. All the versions are latest release versions (no pre-releases or versions to upgrade).
2 remaining items
github-actions commentedon Mar 28, 2026
Hey Eleanor Boyd (@eleanorjboyd), this issue might need further attention.
Antoine Meicler (@ameicler), you can help us out by closing this issue if the problem no longer exists, or adding more information.
ameicler commentedon Apr 3, 2026
Hi Eleanor Boyd (@eleanorjboyd), thanks for the support. Now facing same error as mark-sinclair:
Extension is
ms-python.python-2026.4.0-darwin-arm64.Let me know if you need additional information.
whardier commentedon Apr 19, 2026
Is this what ultimately leads to the python version not being updated in the details bar at the bottom of the IDE as well? Like when we select a workspace level virtual environment.
Add GitHub issue templates (Bug Report, Feature Request, Question) (#…
Add GitHub issue templates (Bug Report, Feature Request, Question) (m…
edvilme commentedon May 5, 2026
From the logs, it appears that the issue is caused by the Python extension (
ms-python.python). Can you please confirm if the issue persists without the Python environments extension?Fix duplicate command python.getRecommendedEnvironment (#25947)