{"record":{"id":"0e0ab08dc65f72a9","repo":"wavetermdev/waveterm","slug":"wsl-distro-s-not-found","errorCode":null,"errorMessage":"wsl distro %s not found","messagePattern":"wsl distro (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wsl/wsl-win.go","lineNumber":125,"sourceCode":"}\n\nfunc (c *WslCmd) SetStderr(stderr io.Writer) {\n\tc.c.Stderr = stderr\n}\n\nfunc GetDistroCmd(ctx context.Context, wslDistroName string, cmd string) (*WslCmd, error) {\n\tdistros, err := RegisteredDistros(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, distro := range distros {\n\t\tif distro.Name() != wslDistroName {\n\t\t\tcontinue\n\t\t}\n\t\twrappedDistro := Distro{distro}\n\t\treturn wrappedDistro.WslCommand(ctx, cmd), nil\n\t}\n\treturn nil, fmt.Errorf(\"wsl distro %s not found\", wslDistroName)\n}\n\nfunc GetDistro(ctx context.Context, wslDistroName WslName) (*Distro, error) {\n\tdistros, err := RegisteredDistros(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, distro := range distros {\n\t\tif distro.Name() != wslDistroName.Distro {\n\t\t\tcontinue\n\t\t}\n\t\twrappedDistro := Distro{distro}\n\t\treturn &wrappedDistro, nil\n\t}\n\treturn nil, fmt.Errorf(\"wsl distro %s not found\", wslDistroName)\n}\n","sourceCodeStart":107,"sourceCodeEnd":142,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wsl/wsl-win.go#L107-L142","documentation":"On Windows, GetDistroCmd enumerates registered WSL distributions via RegisteredDistros and matches by name. This error is returned when the requested wslDistroName does not match any installed distribution (or enumeration found nothing usable).","triggerScenarios":"Calling wsl.GetDistroCmd on Windows with a distro name that is not installed (typo, distro uninstalled, name differing from wsl -l output), or when RegisteredDistros returns an empty list.","commonSituations":"Distro removed or upgraded (renamed) after a Wave connection was configured; referencing 'Ubuntu-20.04' when only 'Ubuntu-22.04' is installed; WSL never installed on the machine.","solutions":["Run 'wsl -l -v' (or wsl.RegisteredDistros) and use an exact name from the list in GetDistroCmd","Install the missing distro with 'wsl --install -d <DistroName>'","Update stale Wave connection configs to point at an installed distro","Ensure WSL is initialized (run 'wsl --status'); a broken WSL install can yield an empty distro list"],"exampleFix":"// before\ncmd, err := wsl.GetDistroCmd(ctx, \"Ubuntu-20.04\", \"ls\")\n// after\ndistros, _ := wsl.RegisteredDistros(ctx)\nvar name string\nfor _, d := range distros {\n    if strings.HasPrefix(d.Name(), \"Ubuntu\") {\n        name = d.Name()\n        break\n    }\n}\ncmd, err := wsl.GetDistroCmd(ctx, name, \"ls\")","handlingStrategy":"validation","validationCode":"func distroInstalled(ctx context.Context, name string) bool {\n    distros, err := wsl.RegisteredDistros(ctx)\n    if err != nil { return false }\n    for _, d := range distros {\n        if d.Name() == name { return true }\n    }\n    return false\n}","typeGuard":null,"tryCatchPattern":"cmd, err := wsl.GetDistroCmd(ctx, distroName, command)\nif err != nil && strings.Contains(err.Error(), \"not found\") {\n    return fmt.Errorf(\"distro %q is not installed; run 'wsl -l -v' and 'wsl --install -d %s'\", distroName, distroName)\n}","preventionTips":["Validate distro names against RegisteredDistros before use","Update saved Wave WSL connection configs after installing/removing distros","Use the exact name from 'wsl -l -v' including version suffix (e.g. Ubuntu-22.04)"],"tags":["wsl","windows","distro-not-found","config"],"backgroundTag":"wsl-distro-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}