{"record":{"id":"b55b559a01bbfcc1","repo":"lima-vm/lima","slug":"failed-to-create-s-disk-q-w","errorCode":null,"errorMessage":"failed to create %s disk %#q: %w","messagePattern":"failed to create (.+?) disk %#q: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vz_driver_darwin.go","lineNumber":419,"sourceCode":"// After successful installation, `image.ipsw` and `image` are removed.\nfunc (l *LimaVzDriver) createDiskMacOSGuest(ctx context.Context) error {\n\tdisk := filepath.Join(l.Instance.Dir, filenames.Disk)\n\n\tdiskSize, err := units.RAMInBytes(*l.Instance.Config.Disk)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid disk size %#q: %w\", *l.Instance.Config.Disk, err)\n\t}\n\n\tswitch l.diskImageFormat {\n\tcase asif.Type:\n\t\tif err := asifutil.NewASIF(disk, diskSize); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase raw.Type:\n\t\tlogrus.Debugf(\"Using %s disk image for macOS guest\", l.diskImageFormat)\n\t\tdiskUtil := &nativeimgutil.NativeImageUtil{}\n\t\tif err := diskUtil.CreateDisk(ctx, disk, diskSize); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create %s disk %#q: %w\", l.diskImageFormat, disk, err)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported disk format for macOS guest: %s\", l.diskImageFormat)\n\t}\n\n\tif err = ensureIPSW(l.Instance.Dir); err != nil {\n\t\treturn err\n\t}\n\tipsw := filepath.Join(l.Instance.Dir, filenames.ImageIPSW)\n\n\tvm, err := createVMForMacInstaller(ctx, l.Instance)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Info(\"Running macOS installer (takes a few minutes)\")\n\t// FIXME: do we need to run the installer for every new instance,\n\t// or can we safely reuse the installed disk image?","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vz_driver_darwin.go#L401-L437","documentation":"For macOS guests with the 'raw' disk image format, the VZ driver creates the disk image via `nativeimgutil.NativeImageUtil.CreateDisk`. Any failure (I/O error, insufficient disk space, path issues) is wrapped as `failed to create <format> disk <path>`, preserving the underlying cause with `%w`.","triggerScenarios":"`CreateDisk` -> `createDiskMacOSGuest` on a macOS guest where `diskUtil.CreateDisk(ctx, disk, diskSize)` returns an error while creating the raw disk at <instance-dir>/basedisk.","commonSituations":"Host volume out of free space; permission problems in the Lima instance directory; the target file being locked or on a filesystem that cannot host the image (e.g. network mounts).","solutions":["Free up disk space on the volume hosting ~/.lima","Check permissions on the instance directory and re-run `limactl create`","Read the wrapped `%w` cause in the message for the actual failure and address it","Delete the partially created disk file and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"disk := filepath.Join(instanceDir, \"basedisk\")\nif fi, err := os.Stat(filepath.VolumePath(disk)); err == nil {\n    // check free space >= requested disk size before creating\n    _ = fi\n}","typeGuard":null,"tryCatchPattern":"err := driver.CreateDisk(ctx)\nvar wrapped interface{ Unwrap() error }\nif errors.As(err, &wrapped) {\n    log.Printf(\"disk creation failed: %v\", wrapped) // inspect root cause\n}","preventionTips":["Keep free disk space well above the configured VM disk size","Avoid placing LIMA_HOME on network or read-only mounts","Check instance dir permissions if creation fails repeatedly"],"tags":["macos","vz","disk-creation","io-error"],"backgroundTag":"disk-image-creation-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}