Skip to content

Noisy startup errors: workspaceSearchPaths warning spam and unresolved ${workspaceFolder} sent to PET #1289

@karthiknadig

Description

@karthiknadig

Problem

During extension startup, two noisy error patterns appear in the output log:

1. workspaceSearchPaths error logged multiple times per session

The error python-envs.workspaceSearchPaths is set at the user/global level, but this setting can only be set at the workspace or workspace folder level is logged every time getWorkspaceSearchPaths() is called. Since configure() is called before every doRefresh() and resolve() operation during startup, the same error appears 6-8 times in a single activation.

This violates the project guideline: "Avoid showing the same error message multiple times in a session."

2. Unresolved ${workspaceFolder} passed to PET resolve

When python.defaultInterpreterPath is set to ${workspaceFolder}/.venv/bin/python3 and the priority chain runs in global scope (no workspace folder), resolveVariables() cannot resolve ${workspaceFolder}. The literal string ${workspaceFolder}/.venv/bin/python3 is then sent to PET's resolve RPC, which fails with:

Failed to execute Python to resolve info "${workspaceFolder}/.venv/bin/python3": No such file or directory (os error 2)

The extension does recover via auto-discovery fallback, but the PET error is unnecessary and alarming to users.

Expected Behavior

  1. The workspaceSearchPaths global-level warning should be logged at most once per session
  2. Paths with unresolved variables (${...}) should be detected before calling PET resolve, with a clear warning and immediate fallback to auto-discovery

Reproduction

  1. Set python-envs.workspaceSearchPaths at the user/global level in settings.json
  2. Set python.defaultInterpreterPath to ${workspaceFolder}/.venv/bin/python3
  3. Open a workspace — observe repeated errors in the Python Environments output channel

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions