{"record":{"id":"e8a2b90959bb4f9b","repo":"abiosoft/colima","slug":"error-deleting-lima-disk-w-output-s","errorCode":null,"errorMessage":"error deleting lima disk: %w, output: %s","messagePattern":"error deleting lima disk: %w, output: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/limautil/disk.go","lineNumber":78,"sourceCode":"\n\tif err := cmd.Run(); err != nil {\n\t\treturn fmt.Errorf(\"error resizing disk: %w, output: %s\", err, buf.String())\n\t}\n\n\treturn nil\n}\n\n// DeleteDisk deletes lima disk for the current instance.\nfunc DeleteDisk() error {\n\tname := config.CurrentProfile().ID\n\n\tvar buf bytes.Buffer\n\tcmd := Limactl(\"disk\", \"delete\", name)\n\tcmd.Stderr = &buf\n\tcmd.Stdout = &buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn fmt.Errorf(\"error deleting lima disk: %w, output: %s\", err, buf.String())\n\t}\n\n\treturn nil\n}\n\n// MountPoint returns the lima disk mount point for the current instance.\nfunc MountPoint() string { return fmt.Sprintf(\"/mnt/lima-%s\", config.CurrentProfile().ID) }\n\n// DiskPrivisioned returns if the disk exists and has been provisioned for the specified runtime.\nfunc DiskProvisioned(runtime string) bool {\n\tif !HasDisk() {\n\t\treturn false\n\t}\n\n\ts, _ := store.Load()\n\treturn s.DiskFormatted && s.DiskRuntime == runtime\n}\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/limautil/disk.go#L60-L96","documentation":"Returned by limautil.DeleteDisk when 'limactl disk delete <profileID>' fails, with limactl's combined output attached. It runs during teardown when the profile's additional/data disk must be removed.","triggerScenarios":"Deleting a disk that is still attached to a running (or not fully stopped) Lima instance, a disk that no longer exists, or limactl being unable to reach its config directory.","commonSituations":"'colima delete' or 'colima stop --disk' while the VM is still shutting down; deleting twice in a row (second pass finds no disk); corrupted ~/.lima state confusing limactl.","solutions":["Stop the VM first ('colima stop') and wait for 'colima status' to report stopped, then retry the delete","If the disk is already gone, treat as success — verify with 'limactl disk list'","As a last resort remove Lima's disk assets manually from the lima disks directory, then retry"],"exampleFix":"# before: delete while running -> 'in use' error\ncolima delete --force\n# after\ncolima stop && sleep 5 && colima delete","handlingStrategy":"fallback","validationCode":"// delete only when present\nif !limautil.HasDisk() {\n    return nil // nothing to delete\n}\nreturn limautil.DeleteDisk()","typeGuard":null,"tryCatchPattern":"In Go: if err := limautil.DeleteDisk(); err != nil { if strings.Contains(err.Error(), \"not found\") || strings.Contains(err.Error(), \"does not exist\") { return nil }; return err } — treat already-gone as success.","preventionTips":["Stop the VM and wait for 'colima status' to report stopped before deleting disks","Never run delete concurrently with start/stop on the same profile"],"tags":["disk","cleanup","limactl","teardown"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}