lima-vm/lima · error
failed to create %s disk %#q: %w
Error message
failed to create %s disk %#q: %w
What it means
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`.
Source
Thrown at pkg/driver/vz/vz_driver_darwin.go:419
// After successful installation, `image.ipsw` and `image` are removed.
func (l *LimaVzDriver) createDiskMacOSGuest(ctx context.Context) error {
disk := filepath.Join(l.Instance.Dir, filenames.Disk)
diskSize, err := units.RAMInBytes(*l.Instance.Config.Disk)
if err != nil {
return fmt.Errorf("invalid disk size %#q: %w", *l.Instance.Config.Disk, err)
}
switch l.diskImageFormat {
case asif.Type:
if err := asifutil.NewASIF(disk, diskSize); err != nil {
return err
}
case raw.Type:
logrus.Debugf("Using %s disk image for macOS guest", l.diskImageFormat)
diskUtil := &nativeimgutil.NativeImageUtil{}
if err := diskUtil.CreateDisk(ctx, disk, diskSize); err != nil {
return fmt.Errorf("failed to create %s disk %#q: %w", l.diskImageFormat, disk, err)
}
default:
return fmt.Errorf("unsupported disk format for macOS guest: %s", l.diskImageFormat)
}
if err = ensureIPSW(l.Instance.Dir); err != nil {
return err
}
ipsw := filepath.Join(l.Instance.Dir, filenames.ImageIPSW)
vm, err := createVMForMacInstaller(ctx, l.Instance)
if err != nil {
return err
}
logrus.Info("Running macOS installer (takes a few minutes)")
// FIXME: do we need to run the installer for every new instance,
// or can we safely reuse the installed disk image?View on GitHub (pinned to dd909d0973)
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
Defensive patterns
Strategy: try-catch
Validate before calling
disk := filepath.Join(instanceDir, "basedisk")
if fi, err := os.Stat(filepath.VolumePath(disk)); err == nil {
// check free space >= requested disk size before creating
_ = fi
} Try / catch
err := driver.CreateDisk(ctx)
var wrapped interface{ Unwrap() error }
if errors.As(err, &wrapped) {
log.Printf("disk creation failed: %v", wrapped) // inspect root cause
} Prevention
- 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
When it happens
Trigger: `CreateDisk` -> `createDiskMacOSGuest` on a macOS guest where `diskUtil.CreateDisk(ctx, disk, diskSize)` returns an error while creating the raw disk at <instance-dir>/basedisk.
Common situations: 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).
Related errors
- failed to create virtio sound device configuration: %w
- VZ driver requires macOS 13 or higher to run
- `firmware.images` configuration is not supported for VZ driv
- unsupported arch: %#q
- vmOpts.vz.diskImageFormat=%#q requires macOS 26 or higher to
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/b55b559a01bbfcc1.
Report an issue: GitHub.