Skip to content

Fix conda named environment creation after conda 25.11 - #1643

Merged
Eduardo Villalpando Mello (edvilme) merged 1 commit into
microsoft:mainfrom
jezdez:fix/conda-env-prefix-discovery
Jul 22, 2026
Merged

Fix conda named environment creation after conda 25.11#1643
Eduardo Villalpando Mello (edvilme) merged 1 commit into
microsoft:mainfrom
jezdez:fix/conda-env-prefix-discovery

Conversation

@jezdez

@jezdez Jannis Leidel (jezdez) commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

conda info --envs --json stopped including envs_dirs in conda 25.11. The extension persisted an empty prefix list and later searched it after conda had successfully created a named environment.

This change:

  • reads envs_dirs from full conda info --json instead of the filtered --envs response
  • treats empty cached prefix lists as stale and retries the query
  • runs named creation with --quiet --json and accepts both the current top-level prefix and legacy actions.PREFIX

References conda/conda#16430 and the named-environment failure in #1454.

@jezdez
Jannis Leidel (jezdez) marked this pull request as ready for review July 20, 2026 19:45
@jezdez
Jannis Leidel (jezdez) force-pushed the fix/conda-env-prefix-discovery branch from dcedeaa to 2cf3ac7 Compare July 20, 2026 21:02
@edvilme Eduardo Villalpando Mello (edvilme) added the bug Issue identified by VS Code Team member as probable bug label Jul 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

const state = await getWorkspacePersistentState();
const storedPrefixes = await state.get<string[]>(CONDA_PREFIXES_KEY);
if (storedPrefixes && Array.isArray(storedPrefixes)) {
if (Array.isArray(storedPrefixes) && storedPrefixes.length > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Array.isArray(storedPrefixes) && storedPrefixes.length > 0) {
if (storedPrefixes?.length > 0) {

@jezdez Jannis Leidel (jezdez) Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't compile with strict TypeScript since storedPrefixes can still be undefined. I'd keep the current check.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Comment thread src/managers/conda/condaUtils.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes Jannis Leidel (@jezdez) :) LGTM

@edvilme
Eduardo Villalpando Mello (edvilme) merged commit 909ef65 into microsoft:main Jul 22, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants