{"record":{"id":"24ec1edd1c4aefbe","repo":"lima-vm/lima","slug":"failed-to-force-stop-vm-after-installation-w","errorCode":null,"errorMessage":"failed to force stop VM after installation: %w","messagePattern":"failed to force stop VM after installation: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vm_darwin_arm64.go","lineNumber":173,"sourceCode":"\t\t\t\tbar.SetCurrent(int64(progress))\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = installer.Install(ctx)\n\tbar.Finish()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstopped, err := vm.RequestStop()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to stop VM after installation: %w\", err)\n\t}\n\tif !stopped {\n\t\tlogrus.WithError(err).Warn(\"VM did not stop after installation\")\n\t\tif err = vm.Stop(); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to force stop VM after installation: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":155,"sourceCodeEnd":178,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vm_darwin_arm64.go#L155-L178","documentation":"When RequestStop() reports success but the VM did not actually stop, installMacOS falls back to vm.Stop() (force stop). If that force stop also errors, this wrapped error is thrown, leaving the installer VM possibly still running.","triggerScenarios":"vm.RequestStop() returns stopped==false (VM ignored the graceful stop) and the subsequent vm.Stop() call returns an error during macOS installation.","commonSituations":"Guest hung during installation and refuses both graceful and forced shutdown; Virtualization.framework internal error; macOS host resource pressure.","solutions":["Kill the leftover VM process (via Activity Monitor: search for the VM process) then retry `limactl start`","Delete and recreate the instance: `limactl delete <name> --force`","Reboot the Mac host to clear stuck Virtualization.framework state","Update macOS to the latest release"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := start(); err != nil && strings.Contains(err.Error(), \"failed to force stop VM after installation\") {\n    // manually kill leftover VM processes, clean up, then retry\n    killLeftoverVzProcesses()\n    exec.Command(\"limactl\", \"delete\", instName, \"--force\").Run()\n    err = start()\n}","preventionTips":["Monitor install progress; investigate hangs early instead of letting the VM get stuck","Reboot the host if Virtualization.framework gets into a bad state","Keep macOS updated"],"tags":["vz","vm-lifecycle","macos-guest","install"],"backgroundTag":"vm-stop-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}