Understanding the Error Cause
This specific error code indicates that the WSL service is configured to start with a particular distribution by default, but that distribution no longer exists on your system. When you typewsl or wsl.exe in the Windows Command Prompt or PowerShell without specifying a distribution name, Windows looks for a registered default. If the path to that distribution is broken, the service throws the exception.
Common scenarios include:
- You recently uninstalled Ubuntu 20.04 or another distro via the Microsoft Store or Settings.
- You manually deleted the %LOCALAPPDATA%\Packages folder associated with the Linux distribution.
- A Windows Update reset WSL configurations unexpectedly.
- You switched from WSL1 to WSL2 and the conversion process failed partially.
It is important to note that WSL does not store its configuration in the traditional Windows Registry under HKCU\Lxss. Modern WSL versions manage state within the AppData package folders and use internal database files. Attempting to edit non-existent registry keys will not resolve this issue and may cause further instability.
Step 1: List Available Distributions
Before changing settings, verify which distributions are actually installed and recognized by the current WSL installation. Open PowerShell or Command Prompt as Administrator and run the following command:wsl --list --verbose
This command outputs a table showing the Name, State, and Version of each distribution. Look for your desired distribution (e.g., Ubuntu-20.04, Debian, Kali). If the list is empty or only shows a generic "Docker" entry, you have no active Linux environments. If your target distro appears but is marked as "Stopped," it is installed but not running. If it is completely absent from the list, it must be reinstalled.
Step 2: Reinstall the Missing Distribution
If the distribution is missing from the verbose list, you need to install it again. The most reliable method is using the Microsoft Store or thewsl --install command. For Ubuntu 20.04 specifically, you can use:
wsl --install -d Ubuntu-20.04
This command downloads the latest package from the Microsoft Store backend and registers it with WSL. Once the installation completes, the distribution will appear in the --list --verbose output. Note that this process may take several minutes depending on your internet speed. After installation, ensure the version is set to 2 if you require WSL2 features by running:
wsl --set-version Ubuntu-20.04 2
For more details on choosing between different Ubuntu versions available in the Windows App Store, refer to our guide on Difference between Windows WSL.
Step 3: Set the Default Distribution
Once you have a valid distribution installed, you must tell WSL which one to launch when no specific name is provided. Use the--set-default flag followed by the exact name of the distribution as shown in the verbose list. Names are case-sensitive and often include hyphens.
wsl --set-default Ubuntu-20.04
Replace Ubuntu-20.04 with the name of your preferred distro (e.g., Debian, Kali-Linux). This command updates the internal WSL metadata to point to the new default. It does not modify any external registry keys, avoiding the dangerous misinformation found in older tutorials. You can verify the change by simply typing wsl in a new terminal window; it should now open your specified distribution.
Step 4: Verify WSL Service Status
Sometimes the error persists due to the WSL service itself being stuck or outdated. Ensure you are running the latest version of WSL by executing:wsl --update
This command checks for updates to the WSL kernel and management utilities from Microsoft. After updating, restart the WSL service to clear any cached states:
wsl --shutdown
Then try launching WSL again. If you still encounter issues, consider checking if your Windows OS is fully updated, as WSL relies heavily on recent kernel patches.
Troubleshooting Corrupted Package Files
In rare cases, the distribution is listed but fails to launch even after setting it as default. This suggests corruption in the user data package located at%LOCALAPPDATA%\Packages\<DistributionName>\LocalState. Back up any important files from this directory, then delete the LocalState folder. Next time you launch the distro, WSL will recreate a fresh environment. Be aware that this wipes all data inside that specific Linux instance.
If you are trying to access services running on your Windows host from within this newly restored WSL environment, remember that network loopsback addresses behave differently in WSL2. See How to access http server on host from WSL2? for networking specifics.
Frequently Asked Questions
Why does wsl --list show my distro but I still get the error?
The distro is installed, but it is not set as the default. The error specifically triggers when launching without arguments. Run wsl --set-default [Name] to fix this. Also, ensure the version is 2 if required.
Can I fix this error by editing the Windows Registry?
No, modern WSL does not use standard registry keys for distribution paths. Editing HKCU\Lxss is ineffective and potentially harmful. Use the wsl command-line tools to manage configurations instead.
What if I don't want to reinstall the distro?
If the distro is corrupted but you want to keep the package registration, you can try resetting the WSL global configuration by deleting the %LOCALAPPDATA%\WSL folder. This resets all defaults and kernels to their initial state.
Does this error affect Docker containers running in WSL?
Indirectly, yes. If your Docker Desktop integration relies on a default WSL distro, it may fail to start. However, Docker usually manages its own backend VMs. Check How to Connect to WSL Docker Container using localhost keyword for connectivity issues.
How do I know if my WSL kernel is outdated?
Run wsl --update to fetch the latest Linux kernel components. An outdated kernel can sometimes cause initialization failures that mimic missing distro errors. Always update before troubleshooting deep configuration issues.