lima-vm/lima · error

failed to inspect status: %w

Error message

failed to inspect status: %w

What it means

inspectStatus delegates to driverutil.InspectStatus(ctx, inst), which asks the instance's driver for its current status. Any error there marks the instance StatusBroken and records 'failed to inspect status'. This wraps driver-specific failures (driver not supported on this host, driver binary missing, etc.).

Source

Thrown at pkg/store/instance.go:164

	limaVersionFile := filepath.Join(instDir, filenames.LimaVersion)
	if version, err := os.ReadFile(limaVersionFile); err == nil {
		inst.LimaVersion = strings.TrimSpace(string(version))
		if _, err = versionutil.Parse(inst.LimaVersion); err != nil {
			logrus.Warnf("treating lima version %#q from %#q as very latest release", inst.LimaVersion, limaVersionFile)
		}
	} else if !errors.Is(err, os.ErrNotExist) {
		inst.Errors = append(inst.Errors, err)
	}
	inst.Param = y.Param
	return inst, nil
}

func inspectStatus(ctx context.Context, instDir string, inst *limatype.Instance, y *limatype.LimaYAML) {
	status, err := driverutil.InspectStatus(ctx, inst)
	if err != nil {
		inst.Status = limatype.StatusBroken
		inst.Errors = append(inst.Errors, fmt.Errorf("failed to inspect status: %w", err))
		return
	}

	if status == "" {
		inspectStatusWithPIDFiles(instDir, inst, y)
		return
	}

	inst.Status = status
}

func inspectStatusWithPIDFiles(instDir string, inst *limatype.Instance, y *limatype.LimaYAML) {
	var err error
	inst.DriverPID, err = ReadPIDFile(filepath.Join(instDir, filenames.PIDFile(*y.VMType)))
	if err != nil {
		inst.Status = limatype.StatusBroken
		inst.Errors = append(inst.Errors, err)
	}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Check the instance's vm-type in ~/.lima/<inst>/lima.yaml matches the current platform
  2. Reinstall/repair the virtualization backend (e.g. qemu) so its binaries are on PATH
  3. Run `limactl doctor` to diagnose driver/backend health
  4. Stop and restart the instance; recreate it with a supported driver if the platform changed

Example fix

// before: vz instance inspected on Linux
// after: recreate with qemu
limactl delete myvm; limactl create --vm-type qemu template://default myvm
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the backend is functional first
// e.g. run `limactl doctor` and check the vm-type matches the platform

Try / catch

inst, err := store.Inspect(ctx, instDir)
if inst.Status == limatype.StatusBroken {
    for _, e := range inst.Errors {
        if strings.Contains(e.Error(), "failed to inspect status") {
            // driver issue: check platform support, reinstall backend, or recreate instance
        }
    }
}

Prevention

When it happens

Trigger: driverutil.InspectStatus returns error: the instance's configured driver (qemu/vz/wsl2 etc.) cannot report status — driver unsupported on the current platform, driver executable missing, or driver-specific query failed.

Common situations: Instance created on macOS with vz driver inspected on Linux; QEMU installed via a different prefix after an upgrade; Lima upgrade changed driver support matrix; partial installation missing driver helpers.

Related errors


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