Skip to content

[Bug]: Desktop runs wsl.exe --list --verbose on Windows hosts without WSL, triggering the Windows WSL install prompt #21038

Closed

Description

@rabranruken

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. Use a Windows 11 machine where WSL is not installed (no WSL package, no distros). C:\Windows\System32\wsl.exe still exists there, because Windows 11 ships it as a stub.
  2. Leave the WSL backend off (the default). My desktop-settings.json has no wsl* keys at all.
  3. Launch T3 Code desktop and open the command palette, or open Settings.
  4. Windows shows its WSL install prompt. Opening the palette or Settings again more than 30 seconds later shows it again.

Expected behavior

The desktop does not start wsl.exe on a machine where WSL is not installed. isAvailable should be false there, so readWslState skips listDistros. The comment in apps/desktop/src/ipc/methods/wsl.ts already says this is the intent: "Only enumerate distros when WSL is actually available — listDistros on a non-WSL host would spawn wsl.exe…"

Actual behavior

makeIsAvailable in apps/desktop/src/wsl/DesktopWslEnvironment.ts returns true when %WINDIR%\System32\wsl.exe exists. That file is present on every Windows 11 install, even when WSL is not installed, so the check always passes on Windows 11.

So readWslState (the desktop:get-wsl-state IPC handler) calls listDistros, which runs probeWslDistros, which spawns wsl.exe --list --verbose. The renderer asks for that state from desktopWslStateAtom (30 s stale time, revalidateOnMount: true). That atom is used by useAvailableSettingsSearchItems, which OpenCommandPaletteDialog and SettingsSidebarNav call, and by ConnectionsSettings. The command palette's add-project folder picker also calls getWslState directly. So opening the palette or Settings is enough. The stub exits with code 1 after about 43 ms, and Windows shows the WSL install prompt. listDistros hides the error with orElseSucceed(() => []), so the app logs nothing a user would see. The only visible effect is the Windows prompt.

This happens with the WSL backend off. The only setting that stops it is localEnvironmentEnabled: false, which also turns off the local environment.

The check came in with #2751 and has not changed since. The tests stub isAvailable, so none of them covers a host where wsl.exe exists but WSL is not installed. The code is unchanged on main @ 16918b5.

The startup paths are fine. With the WSL backend off, reconcile and resolveWslStartConfig never reach probeWslDistros.

Possible direction, untested: treat WSL as available only when at least one distro is registered (subkeys under HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss), not when wsl.exe exists. On this machine that key exists but has no distro subkeys.

Impact

Minor bug or occasional failure

Version or commit

0.1.1-nightly.20261017.3272 (code unchanged on main @ 16918b5)

Environment

Windows 11 x64, build 10.0.26200; T3 Code (Nightly) desktop 0.1.1-nightly.20261017.3272; WSL not installed (no WSLService, no WSL Store package, no registered distros). System32\wsl.exe is the inbox microsoft-windows-lxss component, 10.0.26100.8737.

Logs or stack traces

# <home>\.t3\userdata\logs\desktop.trace.ndjson (times local, 2026-10-17)
15:26:00  desktop.bootstrap
15:26:31  desktop.wsl.isAvailable    Success
15:26:31  desktop.wsl.probeDistros   Failure  43.1 ms
          DesktopWslDistroListError: wsl.exe --list --verbose exited with code 1
              at desktop.wsl.probeDistros (...\app.asar\apps\desktop\dist-electron\main.cjs:139168:60)
              at desktop.wsl.listDistros  (...\main.cjs:139171:59)
              at desktop.ipc.wsl.getState (...\main.cjs:68442:73)
15:26:31  desktop.wsl.listDistros    Success  43.5 ms   # error swallowed by orElseSucceed

# desktop.trace.ndjson.2, same day
11:51:56  desktop.wsl.probeDistros   Failure  43.4 ms   (same error and stack)

Screenshots, recordings, or supporting files

No response

Workaround

None that keeps the app usable. Setting localEnvironmentEnabled: false stops the probe but turns off the local environment.

Activity

  1. juliusmarminge commented on Oct 17, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Confirmed on main @ 16918b5. makeIsAvailable only checks that %WINDIR%\System32\wsl.exe exists, so on Windows 11 it always returns true. desktop:get-wsl-state then calls listDistros, which runs probeWslDistros (wsl.exe --list --verbose) whenever localEnvironmentEnabled is on. Nothing checks wslBackendEnabled before probing, and the failure is swallowed by orElseSucceed. Opening the command palette or Settings loads desktopWslStateAtom (30s stale, revalidateOnMount), which triggers that path. Open PR #20956 does not change this. Keeping this open as a bug.

  2. added
    acceptedfeature request accepted
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions