{"record":{"id":"dd093cdcccc2b41e","repo":"lima-vm/lima","slug":"invalid-disk-size-q-w","errorCode":null,"errorMessage":"invalid disk size %#q: %w","messagePattern":"invalid disk size %#q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vz_driver_darwin.go","lineNumber":407,"sourceCode":"\t\t}\n\t}\n\treturn driverutil.EnsureDisk(ctx, l.Instance.Dir, *l.Instance.Config.Disk, l.diskImageFormat)\n}\n\n// createDiskMacOSGuest creates `disk` and installs macOS from `image` on it.\n// The function must not be called if `disk` already exists.\n//\n// The function creates the following files:\n// - `image.ipsw`: hardlink to `image` (\".ipsw\" suffix is required by VZMacOSInstaller)\n// - `disk`: raw or ASIF disk (ASIF requires macOS 26+)\n//\n// 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 {","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vz_driver_darwin.go#L389-L425","documentation":"When creating the disk for a macOS (DARWIN OS) guest under the VZ driver, Lima parses `Config.Disk` (a size string like '60GiB') with `units.RAMInBytes`. If the string is not a valid byte-size expression, parsing fails and the error is wrapped as `invalid disk size %#q`.","triggerScenarios":"`limactl create`/`start` of a macOS guest on VZ where the `disk:` field is missing, empty, or not parseable by go-units RAMInBytes (e.g. `disk: \"60GB \"` with odd chars, or an unset nil-safe default being corrupted).","commonSituations":"Hand-edited lima.yaml with a malformed disk size; scripts interpolating empty values into `disk:`; copy-paste that dropped units (e.g. `disk: \"60\"` without unit may also fail depending on parser behavior).","solutions":["Fix the `disk:` value to a valid size string like `60GiB` or `100GB`","Remove the disk field to restore the default size","Run `limactl validate ./lima.yaml` to confirm the value parses"],"exampleFix":"# before\ndisk: 60 Gigs\n# after\ndisk: 60GiB","handlingStrategy":"validation","validationCode":"import \"github.com/alecthomas/units\"\nif _, err := units.RAMInBytes(cfg.Disk); err != nil {\n    // reject/fix the disk value (e.g. \"60GiB\") before create\n}","typeGuard":"func validDiskSize(s string) bool {\n    _, err := units.RAMInBytes(s)\n    return err == nil\n}","tryCatchPattern":"if _, err := units.RAMInBytes(cfg.Disk); err != nil {\n    return fmt.Errorf(\"invalid disk size %q: %w\", cfg.Disk, err)\n}","preventionTips":["Always include units (GiB/GB) in the disk field","Never interpolate possibly-empty shell vars into `disk:`","Run `limactl validate` before `limactl create`"],"tags":["macos","vz","disk-size","config-validation"],"backgroundTag":"invalid-size-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}