Skip to content

TypeError in ms-python.vscode-python-envs during conda discovery — "Cannot read properties of undefined (reading 'map')" #1001

@aimdhill

Description

@aimdhill

Type: Bug

Behaviour

While using VS Code on Windows, the ms-python.vscode-python-envs extension throws a runtime TypeError when discovering conda environments, causing the interpreter selector to hang. Disabling the vscode-python-envs extension makes the interpreter selector work immediately. The crash appears to occur in refreshCondaEnvs while mapping over conda results.

Environment

OS: Windows 11
VS Code: (please add your VS Code version)
Extensions (relevant):
ms-python.vscode-python-envs v1.12.0
ms-python.python v2025.18.0
ms-python.vscode-pylance v2025.10.1
Conda:
conda version: 25.11.0
Miniconda root: miniconda3
Environments:
miniconda3 (base)
USER_DEFINED_ENVIRONMENT_1
USER_DEFINED_ENVIRONMENT_2
USER_DEFINED_ENVIRONMENT_3

Steps to reproduce:

Ensure ms-python.vscode-python-envs extension is enabled.
Launch VS Code (tested both normally and launched from an activated conda shell).
Open Command Palette → Python: Select Interpreter.
Wait while the extension searches for interpreters (it hangs).

Actual behavior

The interpreter discovery hangs and does not list conda environments.
The Extension Host log shows repeated TypeErrors from the envs extension; the Python output channel may be empty.

Diagnostic data

2025-11-25 17:27:25.518 [error] TypeError: Cannot read properties of undefined (reading 'map')
at c:\Users\David.vscode\extensions\ms-python.vscode-python-envs-1.12.0-win32-x64\dist\extension.js:2:548819
at z (c:\Users\David.vscode\extensions\ms-python.vscode-python-envs-1.12.0-win32-x64\dist\extension.js:2:548881)
at c:\Users\David.vscode\extensions\ms-python.vscode-python-envs-1.12.0-win32-x64\dist\extension.js:2:552528
at Array.map ()
at t.refreshCondaEnvs (c:\Users\David.vscode\extensions\ms-python.vscode-python-envs-1.12.0-win32-x64\dist\extension.js:2:552499)
at c:\Users\David.vscode\extensions\ms-python.vscode-python-envs-1.12.0-win32-x64\dist\extension.js:2:524009
(repeated)

What I tried

Verified conda works and returns JSON: C:\Users\David\miniconda3\Scripts\conda.exe info --json returned valid JSON containing "envs": [...].
Reinstalled ms-python.vscode-python-envs (uninstall + install) — no change.
Disabling ms-python.vscode-python-envs makes Python: Select Interpreter list all environments immediately (confirming the extension crash is the cause).

Suspected cause

The extension receives an undefined value where it expects an array and then calls .map on it. Adding defensive checks before mapping (and/or handling unexpected conda output formats) should prevent the crash.
Temporary workaround

Disable the ms-python.vscode-python-envs extension (Extensions view → Disable) — then interpreter selection works.
Request

Please investigate refreshCondaEnvs to add guards for undefined inputs before calling .map, or determine why parsing results in undefined for some conda outputs.
I can attach full conda info --json and code --list-extensions --show-versions outputs if helpful; say if you want me to include those in the issue.

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Behaviour

XXX

Steps to reproduce:

  1. XXX

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)


Behaviour

Steps to reproduce:

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Extension version: 1.12.0
VS Code version: Code 1.106.2 (1e3c50d64110be466c0b4a45222e81d2c9352888, 2025-11-19T16:56:50.023Z)
OS version: Windows_NT x64 10.0.26200
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz (8 x 2904)
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: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.96GB (16.96GB free)
Process Argv --crash-reporter-id 4ce8838b-3f04-4b59-8918-690b004c9c09
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
aj953862:31281341
4f60g487:31327383
nes-set-on:31340697
6abeh943:31336334
envsactivate1:31353494
0574c672:31404437
cloudbuttont:31379625
todos-1:31405332
qwen_all_req:31402696
treatment_gpt5applypatchexclusively:31412086
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
auto_model_enabled:31385282
use-responses-api:31390855
anonusage:31403420
auto_g2946222:31414244
je187915:31401254
3i15c187:31419927
ec5jj548:31422691
nes-cd-300-300:31410882
copilot-nes-oct-t:31418199
terminalsuggestenabled:31426255
cmp-ext-control:31426504
cp_cls_c_966_ss:31426491
defaultvisibility:31426295
defaulttokens:31426298
c0683394:31419495
3fia6346:31423209

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions