{"record":{"id":"1a6307e336ab8441","repo":"lima-vm/lima","slug":"vz-canrequeststop-is-not-supported","errorCode":null,"errorMessage":"vz: CanRequestStop is not supported","messagePattern":"vz: CanRequestStop is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vz_driver_darwin.go","lineNumber":538,"sourceCode":"\t\t// Most Linux machines shutdown within 5 seconds, but macOS machines can take longer.\n\t\ttimeout := time.After(30 * time.Second)\n\t\tticker := time.NewTicker(500 * time.Millisecond)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-timeout:\n\t\t\t\treturn errors.New(\"vz timeout while waiting for stop status\")\n\t\t\tcase <-ticker.C:\n\t\t\t\tl.machine.mu.Lock()\n\t\t\t\tstopped := l.machine.stopped\n\t\t\t\tl.machine.mu.Unlock()\n\t\t\t\tif stopped {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors.New(\"vz: CanRequestStop is not supported\")\n}\n\nfunc (l *LimaVzDriver) GuestAgentConn(_ context.Context) (net.Conn, string, error) {\n\tfor _, socket := range l.machine.SocketDevices() {\n\t\tconnect, err := socket.Connect(uint32(l.vSockPort))\n\t\treturn connect, \"vsock\", err\n\t}\n\n\treturn nil, \"\", errors.New(\"unable to connect to guest agent via vsock port 2222\")\n}\n\nfunc (l *LimaVzDriver) Info(_ context.Context) driver.Info {\n\tvar info driver.Info\n\n\tinfo.Name = \"vz\"\n\tinfo.VsockPort = l.vSockPort\n\tinfo.VirtioPort = l.virtioPort\n\tif l.Instance != nil {","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vz_driver_darwin.go#L520-L556","documentation":"After the 30-second stop wait loop, the VZ driver falls through to this terminal error: it could not confirm the VM stopped and the VZ machine does not expose CanRequestStop support, so the driver has no remaining mechanism to stop the VM. Reaching this line means the normal stop/await paths both failed.","triggerScenarios":"Stop() is called and neither the graceful shutdown check nor the stopped-flag polling succeeded, and the underlying VZ virtual machine object does not implement/support the CanRequestStop path (or the machine is in a state where none of the stop branches returned).","commonSituations":"Guest never actually powered off after `shutdown -h now`; VZ machine in a weird state after a failed start; older macOS/VZ where CanRequestStop is unavailable; a bug where the machine object's stop support was never wired up.","solutions":["Force-stop: `limactl stop --force <instance>` which bypasses the graceful path","Verify with `limactl list` whether the instance still reports Running; kill leftover VM processes if orphaned","Restart the host's Virtualization.framework usage by quitting any VM-consuming processes, then retry stop","Upgrade macOS/Lima — CanRequestStop support depends on Virtualization.framework capabilities","If reproducible, file an issue; reaching this line usually indicates the machine object was not properly initialized"],"exampleFix":"// before\nerr := driver.Stop(ctx) // \"vz: CanRequestStop is not supported\"\n// after\nif err := driver.Stop(ctx); err != nil {\n    // hard kill path\n    driver.Stop(ctx /* force */)\n}","handlingStrategy":"fallback","validationCode":"// detect state before stop\nst, _ := limactlListState(inst)\nif st != \"Running\" { return nil } // nothing to stop","typeGuard":null,"tryCatchPattern":"if err := driver.Stop(ctx); err != nil {\n    if strings.Contains(err.Error(), \"CanRequestStop\") {\n        return forceStop(ctx) // hard-kill fallback\n    }\n    return err\n}","preventionTips":["Never ignore a prior failed stop; resolve state before re-attempting","Run on macOS versions where VZ stop callbacks are supported","Recreate broken instances instead of repeatedly stopping them","Monitor limactl list for stuck Running state"],"tags":["vz-driver","shutdown","macos","unsupported"],"backgroundTag":"vm-shutdown-timeout","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}