{"record":{"id":"2ffdbc629c736ce3","repo":"abiosoft/colima","slug":"error-stopping-vm-w","errorCode":null,"errorMessage":"error stopping vm: %w","messagePattern":"error stopping vm: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/app.go","lineNumber":214,"sourceCode":"\n\t\t\tlog := log.WithField(\"context\", cont.Name())\n\t\t\tlog.Println(\"stopping ...\")\n\n\t\t\tif err := cont.Stop(ctx, force); err != nil {\n\t\t\t\t// failure to stop a container runtime is not fatal\n\t\t\t\t// it is only meant for graceful shutdown.\n\t\t\t\t// the VM will shut down anyways.\n\t\t\t\tlog.Warnln(fmt.Errorf(\"error stopping %s: %w\", cont.Name(), err))\n\t\t\t}\n\t\t}\n\t} else if c.guest.Running(ctx) {\n\t\tlog.Warnln(\"vm not responsive, skipping runtime shutdown\")\n\t}\n\n\t// stop vm\n\t// no need to check running status, it may be in a state that requires stopping.\n\tif err := c.guest.Stop(ctx, force); err != nil {\n\t\treturn fmt.Errorf(\"error stopping vm: %w\", err)\n\t}\n\n\tlog.Println(\"done\")\n\n\tif err := generateSSHConfig(false); err != nil {\n\t\tlog.Trace(\"error generating ssh_config: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (c colimaApp) Delete(data, force bool) error {\n\tconfirmContainerDestruction := func() bool {\n\t\treturn cli.Prompt(\"\\033[31m\\033[1mthis will delete ALL container data. Are you sure you want to continue\")\n\t}\n\n\ts, _ := store.Load()\n\tdiskInUse := s.DiskFormatted\n","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/app/app.go#L196-L232","documentation":"The final and only fatal stop step failed: limactl could not stop the guest VM (c.guest.Stop). Unlike the runtime stop warnings, this error is returned, so `colima stop` exits non-zero and the VM may still be running or wedged.","triggerScenarios":"limactl stop fails: QEMU/VZ process wedged after host sleep or crash, guest unreachable so lima cannot issue the shutdown, or the lima instance state file is inconsistent.","commonSituations":"Mac woke from sleep with the VM frozen; colima/lima upgraded while the old VM was running; VM stuck after a forced host reboot.","solutions":["Escalate to `colima stop --force` which kills the VM without graceful shutdown","Drive lima directly: `limactl list` then `limactl stop colima`, reading ~/.lima/colima logs for the cause","Kill a wedged hypervisor process (qemu-system-*) if it persists, then `colima stop --force`","If the instance is unrecoverable: `colima delete --force && colima start`"],"exampleFix":"# before\ncolima stop\n# error: error stopping vm: ...\n\n# after\ncolima stop --force","handlingStrategy":"retry","validationCode":"// confirm the instance is not wedged before stop\nout, _ := exec.Command(\"limactl\", \"list\", \"--json\").CombinedOutput()\n// if the profile shows an invalid/running-though-crashed state, go straight to --force","typeGuard":null,"tryCatchPattern":"if err := a.Stop(false); err != nil {\n    if strings.Contains(err.Error(), \"error stopping vm\") {\n        return a.Stop(true) // escalate to force stop\n    }\n}","preventionTips":["Use `colima stop` rather than killing the qemu process","After host sleep issues, check `limactl list` state before stopping","If stop fails twice, recreate the instance instead of retrying forever"],"tags":["stop","vm","lima","qemu"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}