Skip to content

Bug: Command 'python.getRecommendedEnvironment' already exists in multi-root workspace #25949

Closed

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:

  1. 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
  1. 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"
            }
        }
    ]
}
  1. Open the workspace in VS Code:
    code /tmp/test-bug/test-bug.code-workspace

  2. Open the Output panel (View→Output) and select "Python" from the dropdown

  3. 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%

Activity

  1. eleanorjboyd commented on Oct 10, 2025

    @eleanorjboyd
    Member

    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

  2. rdbisme commented on Oct 10, 2025

    @rdbisme

    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.

  3. ameicler commented on Oct 12, 2025

    @ameicler
    Author

    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?

  4. eleanorjboyd commented on Dec 18, 2025

    @eleanorjboyd
    Member

    Hello! Gave this a try myself and not seeing this error. Can you send over your full logs?

  5. github-actions commented on Jan 1, 2026

    @github-actions

    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!

  6. kohtala commented on Jan 19, 2026

    @kohtala

    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

    2026-01-19 11:37:26.214 [info] Not enabling terminal env var experiment in multiroot remote workspaces
    2026-01-19 11:37:26.585 [info] > pyenv which python
    2026-01-19 11:37:26.585 [info] cwd: ~/REDACTED/3rdparty/python-torch-docker
    2026-01-19 11:37:31.450 [info] Active interpreter [/home/kohtala/REDACTED/3rdparty/python-torch-docker]:  /home/kohtala/REDACTED/3rdparty/python-torch-docker/.venv314/bin/python
    2026-01-19 11:37:31.466 [info] Running installed packages checker:  {
      id: '/home/kohtala/REDACTED/3rdparty/python-torch-docker/.venv314/bin/python',
      displayName: '.venv314 (3.14.2)',
      detailedDisplayName: '.venv314 (3.14.2)',
      envType: 'Venv',
      envPath: '/home/kohtala/REDACTED/3rdparty/python-torch-docker/.venv314',
      type: 'Virtual',
      path: '/home/kohtala/REDACTED/3rdparty/python-torch-docker/.venv314/bin/python',
      version: {
        raw: '3.14.2.final.0',
        major: 3,
        minor: 14,
        patch: 2,
        build: [],
        prerelease: []
      },
      sysVersion: '3.14.2.final.0',
      architecture: 3,
      sysPrefix: '/home/kohtala/REDACTED/3rdparty/python-torch-docker/.venv314'
    } /home/kohtala/.vscode-server/extensions/ms-python.python-2026.0.0-linux-x64/python_files/installed_check.py /home/kohtala/REDACTED/3rdparty/python-torch-docker/constraints-2.9.1.txt
    2026-01-19 11:37:31.466 [info] > ~/REDACTED/3rdparty/python-torch-docker/.venv314/bin/python ~/.vscode-server/extensions/ms-python.python-2026.0.0-linux-x64/python_files/installed_check.py ~/REDACTED/3rdparty/python-torch-docker/constraints-2.9.1.txt
    2026-01-19 11:37:33.226 [info] Starting Pylance language server.
    2026-01-19 11:37:34.683 [info] > pyenv which python
    2026-01-19 11:37:34.683 [info] cwd: ~/REDACTED/3rdparty/jira
    2026-01-19 11:37:34.714 [error] [
      'Failed to activate a workspace, Class name = v, completed in 154ms, has a falsy return value, Arg 1: <Uri:/home/kohtala/REDACTED/3rdparty/jira/jira/client.py>, Return Value: undefined',
      [Error: command 'python.getRecommendedEnvironment' already exists
      	at mA.registerCommand (file:///home/kohtala/.vscode-server/cli/servers/Stable-585eba7c0c34fd6b30faac7c62a42050bfbc0086/server/out/vs/workbench/api/node/extensionHostProcess.js:116:40445)
      	at Object.registerCommand (file:///home/kohtala/.vscode-server/cli/servers/Stable-585eba7c0c34fd6b30faac7c62a42050bfbc0086/server/out/vs/workbench/api/node/extensionHostProcess.js:213:101356)
      	at d.activate (/home/kohtala/.vscode-server/extensions/ms-python.python-2026.0.0-linux-x64/out/client/extension.js:2:533173)
      	at /home/kohtala/.vscode-server/extensions/ms-python.python-2026.0.0-linux-x64/out/client/extension.js:2:2457
      	at Array.map (<anonymous>)
      	at v.activateWorkspace (/home/kohtala/.vscode-server/extensions/ms-python.python-2026.0.0-linux-x64/out/client/extension.js:2:2447)]
    ]
    2026-01-19 11:37:34.715 [info] Active interpreter [/home/kohtala/REDACTED/3rdparty/jira]:  /home/kohtala/REDACTED/3rdparty/jira/.venv/bin/python
    2026-01-19 11:37:34.716 [info] Starting Pylance language server.
    

    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).

  7. 2 remaining items

  8. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Mar 13, 2026
  9. github-actions commented on Mar 28, 2026

    @github-actions

    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.

  10. ameicler commented on Apr 3, 2026

    @ameicler
    Author

    Hi Eleanor Boyd (@eleanorjboyd), thanks for the support. Now facing same error as mark-sinclair:

    2026-04-03 06:53:57.203 [info] Python interpreter path: ./.venv/bin/python
    2026-04-03 06:53:57.237 [info] > pyenv which python
    2026-04-03 06:53:57.237 [info] cwd: /tmp/test-bug/project-a
    2026-04-03 06:53:59.114 [info] Starting Jedi language server for project-a.
    2026-04-03 06:54:14.442 [info] Python interpreter path: ./.venv/bin/python
    2026-04-03 06:54:14.448 [info] > pyenv which python
    2026-04-03 06:54:14.448 [info] cwd: /tmp/test-bug/project-b
    2026-04-03 06:54:15.401 [info] > conda info --json
    2026-04-03 06:54:15.418 [error] [
      'Failed to activate a workspace, Class name = v, completed in 1002ms, has a falsy return value, Arg 1: <Uri:/tmp/test-bug/project-b/test.py>, Return Value: undefined',
      [Error: command 'python.getRecommendedEnvironment' already exists
      	at cA.registerCommand (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:40442)
      	at Object.registerCommand (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:212:101510)
      	at d.activate (/Users/antoine.meicler/.vscode/extensions/ms-python.python-2026.4.0-darwin-arm64/out/client/extension.js:2:533938)
      	at /Users/antoine.meicler/.vscode/extensions/ms-python.python-2026.4.0-darwin-arm64/out/client/extension.js:2:2437
      	at Array.map (<anonymous>)
      	at v.activateWorkspace (/Users/antoine.meicler/.vscode/extensions/ms-python.python-2026.4.0-darwin-arm64/out/client/extension.js:2:2428)]
    ]

    Extension is ms-python.python-2026.4.0-darwin-arm64.

    Let me know if you need additional information.

  11. whardier commented on Apr 19, 2026

    @whardier

    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.

  12. edvilme commented on May 5, 2026

    @edvilme

    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?

  13. added a commit that references this issue on May 7, 2026
    d48d124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions