lima-vm/lima · error

failed to read instance state for instance %#q because no di

Error message

failed to read instance state for instance %#q because no distro is installed,try running `wsl --install -d Ubuntu` and then re-running Lima

What it means

When `wsl --list --verbose` output indicates no installed distributions AND contains WSL_E_DEFAULT_DISTRO_NOT_FOUND, Lima concludes no Linux distro exists at all (not just this instance) and returns StatusBroken with guidance to install one.

Source

Thrown at pkg/driver/wsl2/vm_windows.go:226

func getWslStatus(ctx context.Context, instName string) (string, error) {
	distroName := "lima-" + instName
	out, err := executil.RunUTF16leCommand([]string{
		"wsl.exe",
		"--list",
		"--verbose",
	}, executil.WithContext(ctx))
	if err != nil {
		return "", fmt.Errorf("failed to run `wsl --list --verbose`, err: %w (out=%#q)", err, out)
	}

	if out == "" {
		return limatype.StatusBroken, fmt.Errorf("failed to read instance state for instance %#q, try running `wsl --list --verbose` to debug, err: %w", instName, err)
	}

	// Check for edge cases first
	if strings.Contains(out, "Windows Subsystem for Linux has no installed distributions.") {
		if strings.Contains(out, "Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND") {
			return limatype.StatusBroken, fmt.Errorf(
				"failed to read instance state for instance %#q because no distro is installed,"+
					"try running `wsl --install -d Ubuntu` and then re-running Lima", instName)
		}
		return limatype.StatusBroken, fmt.Errorf(
			"failed to read instance state for instance %#q because there is no WSL kernel installed,"+
				"this usually happens when WSL was installed for another user, but never for your user."+
				"Try running `wsl --install -d Ubuntu` and `wsl --update`, and then re-running Lima", instName)
	}

	var instState string
	wslListColsRegex := regexp.MustCompile(`\s+`)
	// wsl --list --verbose may have different headers depending on localization, just split by line
	for rows := range strings.SplitSeq(strings.ReplaceAll(out, "\r\n", "\n"), "\n") {
		cols := wslListColsRegex.Split(strings.TrimSpace(rows), -1)
		nameIdx := 0
		// '*' indicates default instance
		if cols[0] == "*" {
			nameIdx = 1

View on GitHub (pinned to dd909d0973)

Solutions

  1. Run `wsl --install -d Ubuntu` and complete the distro first-boot setup
  2. Verify `wsl --list --verbose` now lists a distro
  3. Re-run `limactl start <instance>`
Defensive patterns

Strategy: validation

Validate before calling

// Require a default distro before using Lima WSL2 driver
const out = execSync('wsl.exe --list --quiet').toString('utf16le');
if (!out.trim()) throw new Error('No WSL distro installed; run `wsl --install -d Ubuntu`');

Type guard

null

Try / catch

try {
  await limactlStart(inst);
} catch (e) {
  if (/no distro is installed/.test(String(e))) {
    console.error('Run: wsl --install -d Ubuntu, complete setup, then retry');
  } else throw e;
}

Prevention

When it happens

Trigger: getWslStatus parses output containing 'Windows Subsystem for Linux has no installed distributions.' plus 'Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND' while inspecting/deleting/starting an instance.

Common situations: Fresh Windows machine where WSL was enabled but `wsl --install` never completed; user unregistered all distros; Lima instance created before WSL setup finished.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/0ef2aab78b3bd3d8. Report an issue: GitHub.