{"record":{"id":"be7a8c5ec78d0313","repo":"lima-vm/lima","slug":"failed-to-inspect-status-w","errorCode":null,"errorMessage":"failed to inspect status: %w","messagePattern":"failed to inspect status: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/instance.go","lineNumber":164,"sourceCode":"\n\tlimaVersionFile := filepath.Join(instDir, filenames.LimaVersion)\n\tif version, err := os.ReadFile(limaVersionFile); err == nil {\n\t\tinst.LimaVersion = strings.TrimSpace(string(version))\n\t\tif _, err = versionutil.Parse(inst.LimaVersion); err != nil {\n\t\t\tlogrus.Warnf(\"treating lima version %#q from %#q as very latest release\", inst.LimaVersion, limaVersionFile)\n\t\t}\n\t} else if !errors.Is(err, os.ErrNotExist) {\n\t\tinst.Errors = append(inst.Errors, err)\n\t}\n\tinst.Param = y.Param\n\treturn inst, nil\n}\n\nfunc inspectStatus(ctx context.Context, instDir string, inst *limatype.Instance, y *limatype.LimaYAML) {\n\tstatus, err := driverutil.InspectStatus(ctx, inst)\n\tif err != nil {\n\t\tinst.Status = limatype.StatusBroken\n\t\tinst.Errors = append(inst.Errors, fmt.Errorf(\"failed to inspect status: %w\", err))\n\t\treturn\n\t}\n\n\tif status == \"\" {\n\t\tinspectStatusWithPIDFiles(instDir, inst, y)\n\t\treturn\n\t}\n\n\tinst.Status = status\n}\n\nfunc inspectStatusWithPIDFiles(instDir string, inst *limatype.Instance, y *limatype.LimaYAML) {\n\tvar err error\n\tinst.DriverPID, err = ReadPIDFile(filepath.Join(instDir, filenames.PIDFile(*y.VMType)))\n\tif err != nil {\n\t\tinst.Status = limatype.StatusBroken\n\t\tinst.Errors = append(inst.Errors, err)\n\t}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/store/instance.go#L146-L182","documentation":"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.).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the instance's vm-type in ~/.lima/<inst>/lima.yaml matches the current platform","Reinstall/repair the virtualization backend (e.g. qemu) so its binaries are on PATH","Run `limactl doctor` to diagnose driver/backend health","Stop and restart the instance; recreate it with a supported driver if the platform changed"],"exampleFix":"// before: vz instance inspected on Linux\n// after: recreate with qemu\nlimactl delete myvm; limactl create --vm-type qemu template://default myvm","handlingStrategy":"try-catch","validationCode":"// Verify the backend is functional first\n// e.g. run `limactl doctor` and check the vm-type matches the platform","typeGuard":null,"tryCatchPattern":"inst, err := store.Inspect(ctx, instDir)\nif inst.Status == limatype.StatusBroken {\n    for _, e := range inst.Errors {\n        if strings.Contains(e.Error(), \"failed to inspect status\") {\n            // driver issue: check platform support, reinstall backend, or recreate instance\n        }\n    }\n}","preventionTips":["Run `limactl doctor` after installing or upgrading virtualization backends","Match vm-type to the OS (vz only on macOS, wsl2 on Windows)","Recreate instances after moving them between machines with different drivers"],"tags":["lima","driver","vm-status"],"backgroundTag":"vm-driver-status-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}